meta:resourcekey="WizardStep1Resource1"
This is what I use to access a App_LocalResources
.
How do I access a resource in App_GlobalResources
?
SOLUTION: Create a resource called Globalresource.resx
in App_GlobalResources
. In the file set a property called Test with the text Hello. Then it is called like Text='<%$ Resources:GlobalResource, Test%>'
Call the GetLocalResourceObject or GetGlobalResourceObject method to read specific resources from a global or local resource file, respectively. These overloaded methods are available in the HttpContext and TemplateControl classes.
Create a folder in whatever project you want to store the resx files in - default, call it "Resources". Create a new resx file with the specific culture and the file name you'll look up later: If you had a shared one, you could do: SharedResource. en-US. resx.
A local resource is specific to a certain page, which is the only one who can access it, while global resources can be accessed from anywhere. Local resources are kept in the special App_LocalResources folder, while global resources are kept in the App_GlobalResources folder.
Text='<%$ Resources:Resource, WizardStep1Resource1 %>'
Text is the name of the property you want to set. Resource is the name of the global Resourcefile resp. ResourceClass and WizardStep1Resource1 is the name of the Resource Text.
See here: http://msdn.microsoft.com/en-us/magazine/cc163566.aspx
You can only access a resource in App_GlobalResources explicitly, using the implicit wiring i.e. meta:resourcekey="WizardStep1Resource1"
is applicable only for local resources
http://msdn.microsoft.com/en-us/library/ms227427.aspx
To access a resource in App_GlobalResources, use explicit localization like
<%= (string)GetGlobalResourceObject("ResourcesClass", "WizardStep1Resource1") %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With