21 Jul 2011
08 Jul 2012
Link to this post
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!