jkirkerx wrote: > I have no clue why it did not work in the Resource Folder. Mine is > modeled from a CS example I found from MSDN. > > But you have to get it to work first, then you can take it to the > next level. > > If someone wishes to elaborate on that,
please feel free to post your > suggestion or knowledge of proper use of the resource folder. > > Make it a great day! Are you using Namespace.Foldername.Resourcename. I guess the correct is: AssemblyName.FolderName.ResourceName and the resource should be
embedded inside the assembly. -- Madhur http://madhurahuja.blogspot.com
I am using C# and the only way I could get this to work was specifying the resource as <NameSpace>.<Folder>.<FileName>.<FileExtension>. For the type parameter, I used the this.GetType()
Note: My structure of the code is as follows:
1. I have a custom control in a separate assembly than the webpage consuming that custom control.
2. My resource is in the same assembly as the custom control and it is the custom control that has the call to the GetWebResourceURL.
madhur25
Member
191 Points
92 Posts
Re: "Page.ClientScript.GetWebResourceUrl" does not work
Mar 09, 2008 07:14 AM|LINK
http://madhurahuja.blogspot.com
Chalam
Member
12 Points
21 Posts
Re: "Page.ClientScript.GetWebResourceUrl" does not work
Sep 21, 2009 04:25 PM|LINK
I had similar problem and I did not give the folder name in the path
and my namespace and assembly name was same just to make my things easy
and it worked with this in the assemblyinfo and same path in while setting the image
<Assembly: System.Web.UI.WebResource("<assembly or namespace>.<image>gif", "image/gif")>
Hawkwood
Member
2 Points
1 Post
Re: "Page.ClientScript.GetWebResourceUrl" does not work
Nov 16, 2009 01:48 PM|LINK
Just my two cents :
For me, it started to work correctly when I stopped using GetType() to get the type to send to GetWebResourceUrl.
When you use GetType() your risk getting a reference to an assembly that is dynamically compiled by ASP.Net and that doesn't contain the resources.
When you use typeof(TypeInTheAssembly) you get a reference to the assembly that you compiled yourself containing the embedded resources.
Jack78
Member
3 Points
8 Posts
Re: "Page.ClientScript.GetWebResourceUrl" does not work
Mar 11, 2010 09:34 AM|LINK
Check that Buid Action is set to Embedded Resource for the image in Solution Explorer > Properties.
Also, use Project Properties > Resource to add resources, not just add a file to the project.
Regards,
Jack
asmund
Member
38 Points
16 Posts
Re: "Page.ClientScript.GetWebResourceUrl" does not work
Mar 12, 2010 07:35 AM|LINK
Step 1) to 3) you got right. Then, the confusion happens, because there are differences in how this is handle in VB vs C#.
The important thing in VB is that the image path is not part of the resource name as it is in C#, so your example would be:
4) In AssemblyInfo.vb:
<Assembly: WebResource("<My Namespace>.test.gif", "image/gif")>5) In CreateChildControl :
MoizTankiwal...
Member
2 Points
1 Post
Re: "Page.ClientScript.GetWebResourceUrl" does not work
May 18, 2010 07:20 PM|LINK
I am using C# and the only way I could get this to work was specifying the resource as <NameSpace>.<Folder>.<FileName>.<FileExtension>. For the type parameter, I used the this.GetType()
Note: My structure of the code is as follows:
1. I have a custom control in a separate assembly than the webpage consuming that custom control.
2. My resource is in the same assembly as the custom control and it is the custom control that has the call to the GetWebResourceURL.
Hope this information will be helpful to others.
-Moiz Tankiwala PMP
GetWebResourceURL RegisterClientScriptInclude generics list "C#"
Wardy
Member
470 Points
126 Posts
Re: "Page.ClientScript.GetWebResourceUrl" does not work
Nov 04, 2011 12:44 PM|LINK
This only works if you add something like .... (in my case i did this with a javascript)
[assembly: WebResource("project.namespace.script.js", "text/javascript")]
... this line needs to go in the Assembly properties (Properties folder in the project root / AssemblyInfo.cs)
SOA, WCF, Silverlight, XNA, ASP.NET, BPM, Data Cleansing / processing.
... Come visit me @ www.ccoder.co.uk