I have an webpage with a calendar, a label to hold a currency value, and a label to say hello. When I select a language from the dropdown, it changes the currency label, the calendar, but hello does not change. Here is the stripped down code for the aspx page and the cs file:
ASPX:
<asp:Label ID="lblLanguageSelection" runat="server"
Text="Select a language: "></asp:Label>
<asp:DropDownList ID="ddlLanguages" runat="server" AutoPostBack="true">
<asp:ListItem Value="auto">Auto</asp:ListItem>
<asp:ListItem Value="en-US">English (US)</asp:ListItem>
<asp:ListItem Value="en-GB">English (GB)</asp:ListItem>
<asp:ListItem Value="de">German</asp:ListItem>
<asp:ListItem Value="fr">French</asp:ListItem>
<asp:ListItem Value="fr-CA">French (Canada)</asp:ListItem>
<asp:ListItem Value="hi">Hindi</asp:ListItem>
<asp:ListItem Value="th">Thai</asp:ListItem>
</asp:DropDownList>
<br /><br />
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
<br /><br />
<asp:Label ID="lblCurrency" runat="server"></asp:Label>
<br /><br />
<asp:Label ID="lblHello" runat="server"></asp:Label>
CS:
protected void Page_Load(object sender, EventArgs e)
{
decimal currency = 65542.43M;
string hello = "Hello";
lblCurrency.Text = string.Format("{0:c}", currency);
lblHello.Text = string.Format("{0}",hello);
}
protected override void InitializeCulture()
{
string language = Request["ddlLanguages"];
if (language != null)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(language);
}
}