V
Vesa Juvonen
Hi,
I'm developing a custom control using VS2005. The control has embedded
resources with it (js, images and css) and when control is rendered to page,
it uses the GetWebResourceUrl funtion to get correct address for the
resources (resources are streamed directly from assembly using
WebResource.axd).
Everything works well with images and javascript files, but for some reason
the css files are not streamed correctly. Is this a restrictions in the
HttpHandler, or something else?
In this case the web site level Themes or css files are not an option (these
are not suitable for reusable control development). Of course the css
attributes could be applied to each html element individually, but this
would cause repeating the style attributes for each element, which would
cause the page sizes to increase unnecessarely.
Sample code to demostrate
-----------------------------------------
-- Code snipped for the Images - Works well --
Embedded image in assembly named as foo.gif
<Assembly: WebResource("foo.gif", "image/gif")> - As a assembly attribute
Me.Page.ClientScript.GetWebResourceUrl Me.GetType, "foo.gif") - for img src
Let's put the link address of image (from client side page) to browser
address box: We can see the image from the assembly.
-- Code snipped for the Images - does not work --
Embedded css in assembly named as BWVerticalMenu.css
<Assembly: WebResource("foo.css", "text/css")>
Me.Page.ClientScript.GetWebResourceUrl Me.GetType, "foo.css") - for htmllink
href property
Let's put the link address of css file (from client side page) to browser
address box: We get empty html page... which was not expected.We would like
to have the css file as in the image case.
--
There's an excellent article concerning this functionality in te MSDN
including sample files:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/webresource.asp
However the samples provided in this article don't work with the released
version of VS2005 (built on earlier version), due minor changes in class
members. f.ex the LinkedStyleSheet is no more accessable from the controls
in the page, since the function has been swithed to protected. Well. in
sense ot current problem, this is not the issues, since we can by pass this
problem using Header.Controls collection and HtmlLink class.
--
Thanks in Advance
- Vsku
I'm developing a custom control using VS2005. The control has embedded
resources with it (js, images and css) and when control is rendered to page,
it uses the GetWebResourceUrl funtion to get correct address for the
resources (resources are streamed directly from assembly using
WebResource.axd).
Everything works well with images and javascript files, but for some reason
the css files are not streamed correctly. Is this a restrictions in the
HttpHandler, or something else?
In this case the web site level Themes or css files are not an option (these
are not suitable for reusable control development). Of course the css
attributes could be applied to each html element individually, but this
would cause repeating the style attributes for each element, which would
cause the page sizes to increase unnecessarely.
Sample code to demostrate
-----------------------------------------
-- Code snipped for the Images - Works well --
Embedded image in assembly named as foo.gif
<Assembly: WebResource("foo.gif", "image/gif")> - As a assembly attribute
Me.Page.ClientScript.GetWebResourceUrl Me.GetType, "foo.gif") - for img src
Let's put the link address of image (from client side page) to browser
address box: We can see the image from the assembly.
-- Code snipped for the Images - does not work --
Embedded css in assembly named as BWVerticalMenu.css
<Assembly: WebResource("foo.css", "text/css")>
Me.Page.ClientScript.GetWebResourceUrl Me.GetType, "foo.css") - for htmllink
href property
Let's put the link address of css file (from client side page) to browser
address box: We get empty html page... which was not expected.We would like
to have the css file as in the image case.
--
There's an excellent article concerning this functionality in te MSDN
including sample files:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/webresource.asp
However the samples provided in this article don't work with the released
version of VS2005 (built on earlier version), due minor changes in class
members. f.ex the LinkedStyleSheet is no more accessable from the controls
in the page, since the function has been swithed to protected. Well. in
sense ot current problem, this is not the issues, since we can by pass this
problem using Header.Controls collection and HtmlLink class.
--
Thanks in Advance
- Vsku