What types of asp.net web controls could I set a background image to? -


i need set background image code asp:image control. there control use in it's place in order background image work?

the code in master file looks this:

<div style="width:21px;" class="icon-img"><asp:image id="img" runat="server" imageurl="/images/icon.png" height="11"  visible="false"/></div> 

your master page.aspx

<div id="mydiv" runat="server" style="width:21px;" class="icon-img"></div> 

your code behind:

protected sub page_load(sender object, e eventargs) handles me.load     mydiv.style("background-image") = "url('mybackground.png')" end sub 

make sure aspx page has given id div , attribute runat="server" (which needed access code behind).

or:

<div id="mydiv" runat="server" style="width:21px;" class="icon-img"><asp:image id="img" runat="server" imageurl="/images/icon.png" height="11"  visible="false"/></div> 

code behind:

protected sub page_load(sender object, e eventargs) handles me.load     img.imageurl = "mybackground.png" end sub 

the difference between both first 1 uses background-image inside div, while second places real image inside div.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -