Problem using Global Resource RRS feed

  • Question

  • User-1621296122 posted

    I have a .resx in my App_GlobalResources folder called MasterResource with an entry as follows:

    <data name="Title_Test" xml:space="preserve">

    <value>This is the Test title</value>



    Then in my master.cs file, I have a method as follows:

    protected string GlobalResource(string key){

     return this.GetGlobalResourceObject("MasterResource", key).ToString();


    Then, in my master file I have the following:

    <asp:Label ID="Label1" runat="server" Text='<%# GlobalResource("Title_Test") %>' />

    When I use this master with an ASPX page, the label just displays nothing. The project compiles and runs just fine, the label just does not display anything.

    Any ideas what might be going wrong? Thanks.


    Tuesday, February 21, 2006 11:06 AM

All replies

  • User153155060 posted

    This may be a bug with GetGlobalResourceObject.  I too have found that empty string is returned when using this method.  You have two alternate options:

    <asp:Label ID="Label1" runat="server" Text="<%$ Resources:MasterResource, Title_Test %>/>

    or in your program, use early binding:  Resources.MasterResource.Title_Test

    Tuesday, February 21, 2006 12:59 PM