private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!Page.IsPostBack )
{
foreach(CultureInfo cInfo in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
ddlCulture.Items.Add(cInfo.Name);
}
}
}
private void ddlCulture_SelectedIndexChanged(object sender, System.EventArgs e)
{
// Get a CultureInfo object based on culture selection in dropdownlist
CultureInfo cInfo = new CultureInfo(ddlCulture.SelectedItem.Text);
// Get a CultureInfo object based on Invariant culture
CultureInfo cInfoNeutral = new CultureInfo(”");
// Display the datetime based on the formatting of the selected culture
TextBox1.Text = Convert.ToString(DateTime.Now , cInfo.DateTimeFormat);
// Create a DateTime variable to hold the Invariant time
DateTime dt ;
dt = Convert.ToDateTime(TextBox1.Text, cInfo.DateTimeFormat);
//Convert the datetime into a string for use in the SQL statement
Label1.Text = “… WHERE ([Date] < ‘” + Convert.ToString(dt, cInfoNeutral.DateTimeFormat) + “‘)”;
}
Posted by
Mahesh ( Tryangled )