Images in webcontrol

  • Thread starter Thread starter RJDev
  • Start date Start date
R

RJDev

Hello,
I have made an webcontrol with images stored in an database.
I have several subfolders importing the webcontrol. Now the images are not loaded wel because of the place of the webcontrol.
Can i chnage the tag below in the code behind place.

'<td id="Cel3" class="Welcom" style="BACKGROUND-ATTACHMENT: fixed; BACKGROUND-IMAGE: url(http://localhost/WebApplication/Controls/WebMainBlobs.aspx?ID=10); BACKGROUND-REPEAT: no-repeat"
width="100%" height="20">Welkom to ...</td>'

I tried to map the Cel3 as System.Web.UI.HtmlControls.HtmlTableCell
And then set the style property but i cannot set BACKGROUND-IMAGE: url.
If anyone nows how to set that specified tag in the propeerties then i am saved.

Regards,
RJ
 
Hi, RJ,

You can try creating a .css file with style definitions. In it you simply
set the path for the images relative to the css file itself.

Hope this helps
Martin
Hello,
I have made an webcontrol with images stored in an database.
I have several subfolders importing the webcontrol. Now the images are not
loaded wel because of the place of the webcontrol.
Can i chnage the tag below in the code behind place.

'<td id="Cel3" class="Welcom" style="BACKGROUND-ATTACHMENT: fixed;
BACKGROUND-IMAGE:
url(http://localhost/WebApplication/Controls/WebMainBlobs.aspx?ID=10);
BACKGROUND-REPEAT: no-repeat"
width="100%" height="20">Welkom to ...</td>'

I tried to map the Cel3 as System.Web.UI.HtmlControls.HtmlTableCell
And then set the style property but i cannot set BACKGROUND-IMAGE: url.
If anyone nows how to set that specified tag in the propeerties then i am
saved.

Regards,
RJ
 
Use the ResolveUrl method. This resolves a relative URL to an absolute URL
based on the value passed. You can either do this in your code behind class
or provide this as inline in your .aspx file itself.
Like below
<img src='<%=ResolveUrl( "../../Images/image1.gif")%>' style="border:0px"
alt="" />
 
Back
Top