views:

102

answers:

3

Hi I am using Resoursce files as described here: http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx

I am setting the culture info programatically as opposed to at the top in the page declaration. Do I need to declare the culture info for each page? Is there something I can do to change the culture info for all pages using one line? I am using a master page. Thank you.

+1  A: 

Set the culture in the code behind for the master page, or on a base class that all of your pages descend from.

Jason Coyne
+1  A: 

You can set the default culture in web.config by adding through the globalization element.

pmarflee
A: 

If you just want the culture to be set to the browser's settings, follow this answer. If you need to set the culture to something programmatically, use the following:

public class MyPage : Page
{
    protected override void InitializeCulture()
    {
        base.InitializeCulture();
        Thread.CurrentThread.CurrentCulture = ...;
        Thread.CurrentThread.CurrentUICulture = ...;
    }
}

Then make sure all of your pages inherit from MyPage instead of Page.

Greg