Multiple Dates Selection in Calendar
I have a Calendar tool on the webform..I am trying to select multiple dates from the calendar. When i select the dates i want them to be selected till i trigger a event.
Its like selecting a range of dates.. I do not want the selectionmode method wherein i can select only a straight week or month..
i should be able to select a range of dates starting and ending on a single calendar.
please check my following code
protected void Selection_Change(object sender, EventArgs e)
{
if (Session["SelectedDates"] != null)
{
List<DateTime> newList = (List<DateTime>)Session["SelectedDates"];
foreach (DateTime dt in newList)
{
if (Calendar1.SelectedDates.Contains(dt) || Calendar1.SelectedDate == dt)
{
Calendar1.SelectedDates.Remove(dt);
}
else
{
Calendar1.SelectedDates.Add(dt);
}
}
list.Clear();
}
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.IsSelected == true)
{
list.Add(e.Day.Date);
}
Session["SelectedDates"] = list;
}