views:

40

answers:

1

I want to have a link that is like this change(en-NZ) which shows the language Im using and that page will take me to another page that has a dropdownlist of countries and their language codes from there I can select from the dropdownlist which has already selected my current language and change it for all my pages, is there any sample code that implements this?

A: 

From the Enterprise Localization Toolkit:

<%@ Page language="C#" Inherits="Microsoft.Toolkits.EnterpriseLocalization.LocalizedPage" 
            trace="false" EnableViewState="true" %>
<%@ Import namespace="Microsoft.Toolkits.EnterpriseLocalization" %>

<script language="C#" runat="server">
void CountryChanged(object src, EventArgs evt)
{
   myLabel.Text = String.Format("Selected {0} with value of {1}", 
            countryDropDown.SelectedIndex, 
               countryDropDown.SelectedItem.Value);
   stateDropDown.Attributes[Settings.KeyName] = 
            countryDropDown.SelectedItem.Value;
   Reload(stateDropDown);
}   
</script>

<html>
<body>
<form runat="server">
   <asp:Label key="ApplicationTitle" runat="server" 
            EnableViewState="false" /><br>
   <asp:DropDownList id="countryDropDown" runat="server" 
      key="CountryList" 
      OnSelectedIndexChanged="CountryChanged" 
      AutoPostBack="true" >
   </asp:DropDownList>
   <asp:DropDownList id="stateDropDown"  key="none" runat="server" />
   <br>
   <asp:Label id="myLabel" runat="server" /><br>
   <a href="Test.aspx">Refresh</a>
</form>
</body>
</html>
rboarman