Using Global Resources in Sitefinity modules

Posted by Community Admin on 04-Aug-2018 21:41

Using Global Resources in Sitefinity modules

All Replies

Posted by Community Admin on 08-Jul-2012 00:00

Hi,

We have a set of customer Sitefinity modules that use global resources that come from the \App_GlobalResources\ (standard .NET) folder. This works fine as long as we use strong typing. So lblTest.Text = Resources.ErrorMessages.GetRecordFailed; works well.

But now i want to create a method that can access all keys from all resx files. In normal ASP.NET projects i can use the following code for this.
return HttpContext.GetGlobalResourceObject(resourceFile, resourceKey).ToString();

But in within a Sitefinity project this doesn't seem to work.
I get the following error:
Could not find the specified key "GetRecordFailed" or class id "ErrorMessages".

And i get the same error when i try to use the Sitefinity version of this code, which i believe should be like this:
lblTest.Text = Res.Get("ErrorMessages", "GetRecordFailed");

Can someone tell me how i can get this code to work?
Thanks in advance!


Posted by Community Admin on 09-Jul-2012 00:00

Is your resource file installed an embedded resource?  You can change this by changing the Build Action under the properties of your resource file.  I am not 100% sure this will work for you but I've had problems like this in the past with ressource files but under a different situation.

This thread is closed