0

I am creating one application in which I am using resource files to keep strings. In my application I am keeping pages in separate folders like all the registration pages are in Register folder. I created on Resources folder in this folder to have all the resource files related to registration module. But, when I am trying to access resource strings

  <asp:Label Text="<%$Resources: RegisterAsUser, userName%>" runat="server" />

It is giving error that userName key is not found. I am not able to figure out the error here.

Can anyone tell what is wrong here?

Thanks, Ashwani

1 Answer 1

1

You are using explicit expressions.

<asp:Label Text="<%$Resources: RegisterAsUser, userName%>" runat="server" />

whereas the other option is implicit expressions

<asp:Label ID="label1" runat="server" meta:resourcekey="userName" ></asp:Label>

For the explicit expressions as I understand it, the purpose of it is to used a shared location, so that resources from many aspx files can access the values from one resource file. For this to work, your resx file RegisterAsUser must be beneath the App_GlobalResources directory.

With implicit, the value is looked from in a resx file with the same name as the aspx file with the correct localization value of course.

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

Comments

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.