Last post Nov 13, 2009 01:21 AM by Allen Chen – MSFT
Nov 10, 2009 01:09 AM|sonicdan|LINK
fine by far, except the CSS background image can't display. The css file is as below:
width: 200px; /*fixed width for the balloon*/
color:#000; /*text color*/
font: 12px sans-serif; /*text size and style*/
text-decoration:none; /*other text decoration*/
text-align:left; /*text alignment*/
padding: 30px 8px 0;
background: url(<%=WebResource("UMControls.Images.bubble.gif")%>) no-repeat top;
padding:3px 8px 15px;
background: url(<%=WebResource("UMControls.Images.bubble.gif")%>) no-repeat bottom;
I'm trying to dynamically refer to one of the included image resource (~\bubble\bubble.gif) in this css file, so I use <%=WebResource("UMControls.Images.bubble.gif")%> to get the URL. However, the background image can't be displayed. The Css file URL in the HTML page shows like this (in firefox):
My question is how I can make the image URL in the separate CSS resource be converted into the correct resource reference? Or is this possible or not?
custom control WebResource CSS image URL reference
Nov 11, 2009 01:33 AM|Allen Chen – MSFT|LINK
Is PerformSubstitution set to true? Please refer to this documentation for more details:
If it still doesn't work please post a demo project that can reproduce this issue. You can upload the project to
http://skydrive.live.com/ and paste download link here.
Nov 11, 2009 07:43 PM|sonicdan|LINK
Thanks mate! This does helped me to work it out! I even didn't know there is such a magic thing called "PerformSubstitution"!
Nov 13, 2009 01:21 AM|Allen Chen – MSFT|LINK
By Page.ClientScript.GetWebResourceUrl method you can get URL of any resources. Then you can output the URL to HTML where you need.
string styleSheet="Get URL by Page.ClientScript.GetWebResourceUrl";
HtmlHead header = Page.Header;
HtmlLink link = new HtmlLink();
link.Href = styleSheet;