locked
webcontrol embedded image url in CSS RRS feed

  • Question

  • User-1221966532 posted

     Hiya,

    I have created a grid webcontrol, simple and general using embedded images from code behind ( ClientScriptManager )  and also from CSS as background-image property. Now while the images referenced from code behind are fine, for some reason the images for the CSS background-image property are not rendered or find. The images are flagged as embedded, the WebResource path is ok in the AssemblyInfo, the CSS is also flagged as embedded resource and the CSS property is like below:

    background-image:url('../Images/GridHeaderBackground.jpg');

    I suspect that this is due the embedded webresource issue, but how could I pass the embedded image's url in the CSS file, like in the code behind:

    this.Page.ClientScript.GetWebResourceUrl(GetType(), "WebControls.Grid.Images.SinglePlus.gif"); 

    I thought that the normal way of url path is enough in the webcontrol, when using the background-image property. Can someone answer this question?

    Thanks

    Ben
     

    Monday, March 17, 2008 7:11 AM

All replies

  • User-1221966532 posted

    I have partially sorted out the issue as I found some blogs on this matter and the solution was to pass an attribute to the CSS webresource in the AssemblyInfo file:

    [assembly: WebResource("WebControls.Grid.CSS.Grid.css", "text/css", PerformSubstitution = true)] 

    as the embedded CSS accessing an embedded image file, so need to use the  PerformSubstitution attribute.

    Monday, March 17, 2008 9:18 AM
  • User-1221966532 posted

    This works only in FF, but for some reason in IE7 if I do an AJAX postback the webresource is present for the image , but it is rendered as no background image.

    Monday, March 17, 2008 9:20 AM
  • User-1136466523 posted

    Hi,

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    This side effect might be related to WebResource caching - when your website is in debug mode (<compilation debug="true" /> in web.config) files streamed by WebResource.axd are not cached by the browser.

    <o:p> </o:p>

    For more information, see:

    http://ocegtech.blogspot.com/2006/06/aspnet-20-webresourceaxd-and-browser.html

    <o:p> </o:p>

    Thanks.

     

    Wednesday, March 19, 2008 5:24 AM