using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["SelectedLang"] != null)
{
ddlLanguage.SelectedValue = Session["SelectedLang"].ToString();
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture
(ddlLanguage.SelectedValue);
Thread.CurrentThread.CurrentUICulture = new CultureInfo
(ddlLanguage.SelectedValue);
}
else
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture
(ddlLanguage.SelectedValue);
Thread.CurrentThread.CurrentUICulture = new CultureInfo
(ddlLanguage.SelectedValue);
}
}
}
protected void ddlLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlLanguage.SelectedValue == "hi-IN")
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("hi-IN");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("hi-IN");
Session["SelectedLang"] = ddlLanguage.SelectedValue;
Server.Transfer(Request.Path);
}
else if (ddlLanguage.SelectedValue == "es-MX")
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("es-MX");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-MX");
Session["SelectedLang"] = ddlLanguage.SelectedValue;
Server.Transfer(Request.Path);
}
else
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Session["SelectedLang"] = ddlLanguage.SelectedValue;
Server.Transfer(Request.Path);
}
}
}