Last post Oct 24, 2007 03:27 AM by kipo
Oct 23, 2007 01:53 AMfirstname.lastname@example.org|LINK
If we are using Master Pages with Content Page.
Where will be the better position to set Current Culture? Content Page or Master Page.
Any references if present.
Oct 23, 2007 02:26 AM|kipo|LINK
I would set it in Master Page, because if you ever get the need to change it, you will need to make changes in only one page (if you have more than one Master Page, than in all of them, but in any case you have less Master Pages than Content Pages). Or even
better, set it in web.config like this:
<globalization culture="hr-HR" uiCulture="auto"/>
Oct 23, 2007 12:23 PM|jamlew|LINK
You can set it in web.config as mentioned, or you'll have to do it in the content pages. As far as I know, there isn't a way to set it in the Master page. If you're setting it the same in all content pages, there's two ways to do it: a) you can edit each
of them to have the correct culture settings, or b) you can create a class that inherits from Page, implement the InitializeCulture method for that class, and then have all your content pages inherit from your new class instead of directly from Page. With
(b), all of your pages will share the same code for setting the culture, so it'll be easier to keep them all consistent if you make later changes.
Oct 23, 2007 01:14 PM|kipo|LINK
As far as I know, there isn't a way to set it in the Master page.
protected void Page_Init(object sender, EventArgs e)
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("hr-HR");
Oct 23, 2007 04:08 PM|jamlew|LINK
I believe resources are set before the Init event is handled. According to [url=http://msdn.microsoft.com/en-us/library/ms178472.aspx]this page[/url], culture is set in the Start event, which precedes the Init event. If you've used that method and it works
though, I may be mistaken.
Oct 24, 2007 03:27 AM|kipo|LINK
I believe resources are set before the Init event is handled.