text: Jun 23, 2010 04:40 AM|imran_khan|LINK
  Hello friends.
  I am working on custom server control. I need to embed js,css and image files in control. I have added js and css file but I am facing a problem to embed images which is in css file. I have set background image in one class in css file but that image does not display when I run the page.
  So Is it possible to add webresourceurl for images which are placed in css file?
  Thanks
  embedded resource custom controlol embedded resources images in css file
  Contributor
  2131 Points
  Jun 23, 2010 04:50 AM|bhadelia.imran|LINK
  Create Theme and put ur css into that theme folder apply that theme to your user control.
  Member
  140 Points
  Jun 23, 2010 04:55 AM|SilverSwan|LINK
  This is possible.
  You need to set the build action of the image/css/js to Embedded Resource and add them to your AssemblyInfo.cs file:
  [assembly: WebResource("yournamespaceandfilename.js", "text/javascript")]
  Then you can register them in your control on the PreRender event:
  Type classType = typeof(MyClass); string myKey = "MyClassKey"; if (!Page.ClientScript.IsClientScriptIncludeRegistered(classType, myKey)) { string scriptLocation = Page.ClientScript.GetWebResourceUrl(classType , "yournamespaceandfilename.js"); Page.ClientScript.RegisterClientScriptInclude(classType, myKey, scriptLocation); }
  Jun 23, 2010 04:58 AM|imran_khan|LINK
  Dear, I am talking about images file which are used in css file. I already registered js and css files but problem to register images file.
  Thanks
  Imrankhan
  Jun 23, 2010 05:00 AM|imran_khan|LINK
  Hey Imran,
  Can you give me some url or example? I have searched in google but not found any helpful article.
  Thanks
  Imrankhan
  All-Star
  98048 Points
  Jun 25, 2010 03:34 AM|Qin Dian Tang - MSFT|LINK
  Hi imran_khan,
  Have a look at these articles about embed resources into custom control. Hope you can find something helpful to your issue:
  Thanks,
  Dec 09, 2010 06:38 PM|webflour|LINK
  Imran,
  Did you find the solution? I am looking for same thing. My embedded css has style:
  .mycustomdiv
  { width: 25px; height: 25px; background-image: url(back.png); }
  back.png is in my custom control project root and is set as embedded resource.
  Also I have an entry in my assemblyInfo...same as my css. But the image won't show up.
  Anyone any ideas?
  Note:The post with several links accepted as answer doesn't talk anything about this scenario.
  6 replies
  Last post Dec 09, 2010 06:38 PM by webflour