I have a calendar which disappears on selecting a date ..but if I select the same date again, the the calendar selected index change doesn't fire..
How do I handle this for same date selection?
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
DateTime dt = new DateTime();
dt = Calendar1.SelectedDate;
string date;
date = dt.Year.ToString() + "/" + dt.Month.ToString() + "/" + dt.Day.ToString();
txtpickupdate.Text = date;
Calendar1.Visible = false;
}
thanks
If you need to use Functionality with same date. You have to write the Calendar_Load event.
Please see the sample
protected void Calendar1_Load(object sender, EventArgs e)
{
if(IsPostBack)
{
DateTime dt = new DateTime();
dt=Calendar1.SelectedDate;
string date;
date = dt.Year.ToString() + "/" + dt.Month.ToString() + "/" + dt.Day.ToString();
txtpickupdate.Text = date;
Calendar1.Visible = false;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.