G
Guest
Hi,
I'm trying to build a master-detail website that uses localisation. It works
quit fine, based on the settings in IE.
I'm using <globalization culture="auto" uiCulture="auto"/>
in the web.config. The default language is show in my menu's. I want to add
a dropdownlist to the master that sets the language if the user wants.
I've added the following code to the Master
Imports System.Threading
Imports System.Globalization
Partial Class main
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not IsPostBack Then
If cboLanguages.Items.Count = 0 Then
cboLanguages.Items.Add(CultureInfo.CreateSpecificCulture("en").NativeName)
cboLanguages.Items(0).Value = "en"
cboLanguages.Items.Add(CultureInfo.CreateSpecificCulture("nl").NativeName)
cboLanguages.Items(1).Value = "nl"
End If
cboLanguages.SelectedValue =
Thread.CurrentThread.CurrentUICulture.Name
End If
End Sub
Protected Sub cboLanguages_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cboLanguages.SelectedIndexChanged
If Not IsNothing(cboLanguages.SelectedValue) And
cboLanguages.SelectedValue <> "" Then
Label1.Text =
CultureInfo.CreateSpecificCulture(cboLanguages.SelectedValue).NativeName
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(cboLanguages.SelectedValue)
Thread.CurrentThread.CurrentUICulture =
Thread.CurrentThread.CurrentCulture
End If
End Sub
End Class
The dropdown is build up correctly, the IE default is shown, but whenever I
change the dropdown (code is fired) than Label1 gets the new choosen Culture,
but the culture for the website is still my default. Also the menu in the
master is not changed.
Who can give me any clues?
Thanks Victor
--
--
Victor Heijke
Microsoft Certified Professional
Software architect at Flores Automatisering
Amsterdam, the Netherlands
http://www.flores.nl
I'm trying to build a master-detail website that uses localisation. It works
quit fine, based on the settings in IE.
I'm using <globalization culture="auto" uiCulture="auto"/>
in the web.config. The default language is show in my menu's. I want to add
a dropdownlist to the master that sets the language if the user wants.
I've added the following code to the Master
Imports System.Threading
Imports System.Globalization
Partial Class main
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not IsPostBack Then
If cboLanguages.Items.Count = 0 Then
cboLanguages.Items.Add(CultureInfo.CreateSpecificCulture("en").NativeName)
cboLanguages.Items(0).Value = "en"
cboLanguages.Items.Add(CultureInfo.CreateSpecificCulture("nl").NativeName)
cboLanguages.Items(1).Value = "nl"
End If
cboLanguages.SelectedValue =
Thread.CurrentThread.CurrentUICulture.Name
End If
End Sub
Protected Sub cboLanguages_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cboLanguages.SelectedIndexChanged
If Not IsNothing(cboLanguages.SelectedValue) And
cboLanguages.SelectedValue <> "" Then
Label1.Text =
CultureInfo.CreateSpecificCulture(cboLanguages.SelectedValue).NativeName
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(cboLanguages.SelectedValue)
Thread.CurrentThread.CurrentUICulture =
Thread.CurrentThread.CurrentCulture
End If
End Sub
End Class
The dropdown is build up correctly, the IE default is shown, but whenever I
change the dropdown (code is fired) than Label1 gets the new choosen Culture,
but the culture for the website is still my default. Also the menu in the
master is not changed.
Who can give me any clues?
Thanks Victor
--
--
Victor Heijke
Microsoft Certified Professional
Software architect at Flores Automatisering
Amsterdam, the Netherlands
http://www.flores.nl