Skip to content Skip to sidebar Skip to footer

Td Background Picture Asp:Image Possible?

I have a given asp.net site in which I change pictures as I need like Image1.ImageUrl = '~/Bilder/B1.png'; These pictures are in table cells as asp.Image. Is it possible to use the

Solution 1:

See the example below -

Front Page -

<!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 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

End Class

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


Post a Comment for "Td Background Picture Asp:Image Possible?"