1

I have in my ASP.NET Web Forms Application resx file localized in App_LocalResources\fr.aspx.resx with key value: hello_world.

Now I want to use it on my ASPxLabel on class Page.aspx, so I simply:

<dx:ASPxLabel ID="0" runat="server" Text="<%$ Resources:fr, hello_world %>"></dx:ASPxLabel>

but I have error: Parser Error Message: The resource object with key 'msg' was not found.

I am sure that fr.aspx.resx is publicated, but still got Parser Error. What I am doing wrong?

1 Answer 1

1

First of all check the name of your resource file. It has to follow the following naming convension

pageName.extension.language.resx

If you aspx page name Page.aspx, then the you should have resource files with the following name.(You can add resource files for further language and culture)

Page.aspx.fr.resx

Check whether you follow this convension or not.

To you this resource in the aspx page you have to follow the convension as below

<%$Resources:Class,ResourceID%>

where Class is the name of resource file, if it is compiled as class, otherwise this can be ignored. ResourceId is the key in the resource file. In your code you are setting the resource as below. Check whether the resource file has a codebehind with the class name fr.

Text="<%$ Resources:fr, hello_world %>">

For more details you can visit the following link http://msdn.microsoft.com/en-us/library/ms227427(v=vs.90).aspx

Sign up to request clarification or add additional context in comments.

3 Comments

Ok. My page is Acceuil.aspx, so to follow convension I change: App_LocalResources\Accueil.aspx.fr.resx and Text="<%$ Resources:Accueil, hello_world %>"> still give me "The resource object with key 'hello_world' was not found."
How many languages do you need to support? If fr is the default language then please delete .fr. in the resource file name. You should name your resource file as App_LocalResources\Accueil.aspx.resx. If you have code behind for this (Accueil.aspx.resx.cs) then check the class name. If you dont have codebehind then change to <%$ Resources:hello_world %>
Yes it helps. I was only supporting one default language and after I delete .fr it solve a problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.