Last post Oct 23, 2008 09:19 AM by plastic_road
Oct 22, 2008 11:36 AM|plastic_road|LINK
I have a website that will be in three different languages, and the client wants to beable to click a flag for the different languages. These flags (buttons) will be in the master page. I have something like this
but when you click on the button the left hand nav which is in the master page does not change language!
Any help would be very much appreciated
Oct 22, 2008 11:46 AM|budugu|LINK
you have to override the InitializeCulture , check this code..
Protected Overloads Overrides Sub InitializeCulture()
Dim culture As String = Session("myCulture")
If String.IsNullOrEmpty(culture) Then
culture = "en-US"
System.Threading.Thread.CurrentThread.CurrentUICulture = New CultureInfo(culture)
'In button click event, add this code..
'change session value depedning on button
Session("myCulture") = "da-DK"
Oct 22, 2008 11:51 AM|plastic_road|LINK
Hi Thanks for your quick reply, I was trying to use the example that you have given and I get this error when i use the overrides
Sub initializeculture cannot be declared overrides because it does not overrirde a sub in a base class.
Not sure what I'm doing wrong.
PS This is in a master page so inherits System.Web.UI.MasterPage, not Page, I think that could be the problem
Oct 22, 2008 12:14 PM|budugu|LINK
The InitiliazeCulture method is a method of the Page class and not of the Masterpage Class.
you need to create a base page class, and override its initiazeCulture() method , then change pages to inherit from the new base class instead of inherting from System.Web.UI.Page class
Oct 22, 2008 04:47 PM|plastic_road|LINK
Thanks for your reply, I knew that InitiliazeCulture wasnt a method of Masterpage class.
My current Master page does not inherit from Page, it inherits from Masterpage class, if I create a base page and override this method, my master page would have to inherite from the base page I think thats what your saying, yeah?
So if I do that will my MasterPage still work correctly?
Oct 23, 2008 09:19 AM|plastic_road|LINK
I created a base page that overrides the InitiliazeCulture method, and in the click event on the master page I put this
But the one thing that i wasnt doing on my pages was inheriting the base class, which I have now done and everything is working well.