The culture can be set for a thread using Thread.CurrentThread.CurrentCulture property.
using System.Threading.CurrentThread
The culture can be set for a thread using Thread.CurrentThread.CurrentCulture property.
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%=DateTime.Now.ToLongDateString() %>
<br />
<%=dt.ToLongDateString() %>
<br />
<asp:Calendar ID="Calendar1" runat="server" BackColor="#FFFFCC"
BorderColor="#FFCC66" BorderWidth="1px" DayNameFormat="Shortest"
Font-Names="Verdana" Font-Size="8pt" ForeColor="#663399" Height="112px"
ShowGridLines="True" Width="125px">
<SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
<SelectorStyle BackColor="#FFCC66" />
<TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
<OtherMonthDayStyle ForeColor="#CC9966" />
<NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
<DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
<TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt"
ForeColor="#FFFFCC" />
</asp:Calendar>
<br />
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Value="en-US" Selected="True">English</asp:ListItem>
<asp:ListItem Value="es-MX">Español</asp:ListItem>
<asp:ListItem Value="de-DE">Deutsch</asp:ListItem>
<asp:ListItem Value="mr-IN">Marathi</asp:ListItem>
<asp:ListItem Value="hi-IN">Hindi (India)</asp:ListItem>
<asp:ListItem Value="gu-IN">Gujarati (India)</asp:ListItem>
<asp:ListItem Value="ja-JP">Japanese </asp:ListItem>
</asp:DropDownList>
</div>
</form>
</body>
</html>
Code
public static DateTime dt = new DateTime();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
dt = (DateTime)Calendar1.SelectedDate;
System.Threading; Thread.CurrentThread.CurrentCulture = new CultureInfo(DropDownList1.SelectedItem.Value.ToString());
}
For English (en-US) Culture setting
For Marathi-India (mr-IN) Culture setting
Download
thx a lot it working fine
ReplyDelete