c# Ajax calender with validation of date format

protected void Btn_Click(object sender, EventArgs e)
{
lblSSMIMessage.Text=””;
string myDateString = txtSendSmsToBusInchargeDate.Text;
string myDateFormat = “MMMM yyyy”;
DateTime outputDateTime;
if (DateTime.TryParseExact(myDateString, myDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out outputDateTime))
{

lblSSMIMessage.Text = outputDateTime.ToString(“MMMM yyyy”);
}
else
{
lblSSMIMessage.Text = “Select valid month.”;
return;
}
}

Advertisements