Last post Feb 21, 2006 12:59 PM by jcasp
None
0 Points
44 Posts
Feb 21, 2006 11:06 AM|nathwdavis|LINK
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></data>
<
</
Then in my master.cs file, I have a method as follows:
protected
}
Then, in my master file I have the following:
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.
Member
160 Points
2280 Posts
Feb 21, 2006 12:59 PM|jcasp|LINK
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
None
0 Points
44 Posts
Problem using Global Resource
Feb 21, 2006 11:06 AM|nathwdavis|LINK
I have a .resx in my App_GlobalResources folder called MasterResource with an entry as follows:
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.
Member
160 Points
2280 Posts
Re: Problem using Global Resource
Feb 21, 2006 12:59 PM|jcasp|LINK
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