ASP.Net 2.0 App_LocalResources subfolders

G

Guest

Hello,
Here is the scenario I need wome help with.
An ASP.Net 2.0 web application with the following structure and content:
Root
Root/App_LocalResources
Root/App_LocalResources/MyControl.ascx.resx

Root/Controls/MyControl.ascx
Root/Controls/MyControl.ascx.cs

I would like to use a localized value from the resx file in the My Control.
The code I use is
<asp:Literal id="SomeId" runat="server" text="<%$ Resources: MyString"%>"/>

where MyString is the the key of an entry in the MyControl.ascx.resx file.

The same code works well if the control is in the root folder. The moment I
move it into a subfolder it stops working. I tried to move the resource file
under a similar subfolder under App_LocalResources but with no success. Any
sample or mention of resource utilization from MS shows only pages hosted
under the root web.

I would appreciate if somebody can shed some light on the rules governing
the new structure. It was a lot easier in ASP.Net 1.1.

Thank you
 
Joined
Oct 25, 2007
Messages
1
Reaction score
0
ASP.Net 2.0 App_LocalResources subfolders...SOLVED!

Ok, I also ran into same problem, wanted to localize pages contained in subfolders, however, adding the matching subfolders to App_LocalResouces did not work. I did bunch of searching, still no answers, and by accident found the solution, hope this helps:

~/App_LocalResources/Default1.aspx.resx
~/Default1.aspx.resx

~/SubFolder/Default2.aspx.resx
~/SubFolder/App_LocalResources/Default2.aspx.resx

So, you need to create App_LocalResources folder, inside each subfolder, and localization works. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top