Click here to Skip to main content
15,905,913 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello...!
I need to set Different UI Cultures for Master page and content page..
could some one help me solving out this..
Thank you..!
Posted

1 solution

You can set the current culture at any point using the following lines:

C#
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-GB");
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-GB");


If you need to change the culture for different components then there's no easy way of doing this. You will have to change the culture within each individual component.

This will get complicated because of the event architecture.

So PreInit, Init, Load, PreRender, Render events do not fire sequentially through the life cycle of each component. They fire in sequence through the page hierarchy. So PreInit will fire in the master page, then page, then controls. The same for all the other events. So you'll have to change the culture for each component for each event.

The best way to do this whilst minimising cross cutting concerns would be to use Aspect Oriented Programming (AOP).

I'd suggest PostSharp. It's a free, compile time AOP add in for Visual Studio.

The following article explains the cutlure behaving within ASP.Net in a little more detail.

http://stackoverflow.com/questions/4876520/programmatically-set-culture-of-user-controls-in-asp-net[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900