Last post Jun 12, 2013 12:28 PM by ddelella
Jun 11, 2013 10:13 PM|ddelella|LINK
the namespace followed by the folder structure. The CSS file is being added during the controls OnInit method as descibed in numerous articles. The WebResource.axd appears in the source of the web page generated in the header as expected. However, the stylesheet
includes a simple class .box which set the background-color to red. I tried applying this style to a div set to 100x100. Nothing happens. Below is some code samples. Any ideas?
<Assembly: WebResource("CustomControls.StyleSheets.Grid.css", "text/css", PerformSubstitution:=True)>
Protected Overrides Sub OnInit(e As System.EventArgs)
Dim CSSLink As New HtmlLink
CSSLink.Href = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "CustomControls.StyleSheets.Grid.css")
<div style="width: 100px; height: 100px" class="box">Red Box</div>
Jun 12, 2013 04:01 AM|bmwz9|LINK
If you are using IE you can use developer tools >Network then start capturing and try to open a page which contains control to see if the resource is loaded or not (might get 404 error)
if so make sure of your resource name and your namespace
Jun 12, 2013 08:19 AM|ddelella|LINK
I am in IE8 with developer tools but there is no Network option to capture while the page loads. However, using FireBug I was able to see that one of the WebResource.axd produced a 404 Not Found and the other a 304 Not Modified.
UPDATE: So despite the css file being located in a sub-directory StyleSheets the reference to the resource still needs to be CustomControls.Grid.css. The file is still in the sub-folder but the resource name doesn't appear to require the folder structure
like all the online documents say.
Jun 12, 2013 09:24 AM|bmwz9|LINK
I would suggest to open the produced dll which contains your control with a reflector application to see the exact resource name and it's namespace
Jun 12, 2013 11:21 AM|ddelella|LINK
Since the issue seems to be the VB compiler not recognizing the folder structure as part of the resource naming does anyone know how to get around this? The reason is that I want to do theming of my controls but want to put the files with the same names
into different folders. With VB it doesn't look like this is possible. I find this to be a major flaw in the VB compiler compared to C#.
The concept would be Namespace.Theme.Images.File and I could dynamically control the theme name from the control when loading the resource. Without a recognized folder structure in the resource name it will not work.
Jun 12, 2013 11:31 AM|bmwz9|LINK
C# projects compiles folders as namespaces by default while VB projects don’t ,So can you change to C# ?
Jun 12, 2013 12:28 PM|ddelella|LINK
Preferrably not. I wish there was another solution. I prefer VB.NET over C#.