TD背景图片的asp:图像可能吗? [英] td background picture asp:Image possible?

查看:172
本文介绍了TD背景图片的asp:图像可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在,我更改照片,因为我需要一个像 Image1.ImageUrl =〜/ BILDER / B1.png一个给定的asp.net网站;

I have a given asp.net site in which I change pictures as I need like Image1.ImageUrl = "~/Bilder/B1.png";

这些图片是在表格单元格为 asp.Image

These pictures are in table cells as asp.Image.

是否有可能使用这些 ASP:图像作为我的背景的细胞?类似< TD风格=背景图片:ID('Image1的'),这样我可以改变背景,因为我需要通过code

Is it possible to use these asp:Image as my background for the cell? Something like <td style="background-image:ID('Image1') so that I can change the background as I need through the code?

推荐答案

请参阅下面的例子 -

See the example below -

头版 -

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
    <table>
        <tr>
            <td>Test</td>
            <td width="178" rowspan="3" background="<%= s_ImageUrl%>"></td>
        </tr>
    </table>
</div>
</form>
</body>
</html>

code的背后 -

Code Behind -

Public Class WebForm1
Inherits System.Web.UI.Page
Public s_ImageUrl As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    s_ImageUrl = "/image/test.jpg"
End Sub

末级

现在你可以改变 s_ImageUrl 变量来改变形象。

Now you can change the s_ImageUrl variable to change the image.

这篇关于TD背景图片的asp:图像可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆