I'm trying to get labels on my site to change depending on the culture set for a particular user.
The default resource will be en-GB and I have a MyName.resx file with an entry:-
I also have a file MyName.en-US.resx with an entry:-Code:Name Value County County
In my page I have this label control:-Code:Name Value County State
And in my Master Page I'm trying to set the culture value of the thread using:-Code:<asp:Label ID="lblCounty" runat="server" Text="<%$Resources:MyName,County %>" />
I've tried this in various page event calls (Page_Load, Page_PreRender etc.) but it keeps using the en-US resource and displaying State on the page.Code:Thread.CurrentThread.CurrentUICulture = new CultureInfo(user.culture); Thread.CurrentThread.CurrentCulture = new CultureInfo(user.culture);
The culture for the user is set to en-GB and if I write out the display name, directly after setting it as above, using the following code, :-
it displays English (United Kingdom)Code:Thread.CurrentThread.CurrentCulture.DisplayName
How do I get the resource files to work correctly?



LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks