More in this section

Forums / Developing with Sitefinity / Using Global Resources in Sitefinity modules

Using Global Resources in Sitefinity modules

2 posts, 0 answered
  1. Tys
    Tys avatar
    21 posts
    Registered:
    21 Jul 2011
    08 Jul 2012
    Link to this post
    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!


  2. Brett Whittington
    Brett Whittington avatar
    89 posts
    Registered:
    10 Aug 2012
    09 Jul 2012
    Link to this post
    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.
2 posts, 0 answered