I have a calendar that can select multiple dates in ASP. The problem is that upon changing to a different month, the Session["SelectedDates"] will be empty (presumably because the previous dates are not in view). This prevents me from selecting multiple dates from multiple months as the dates from the other months will be cleared. How can I fix this problem?

I have been trying store the dates in a temp var during OnVisibleMonthChanged, but I can't get the code to work right.

```
private List<DateTime> datelist = new List<DateTime>();

protected void Calendar1_SelectionChanged(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.SelectedDates.Remove(dt);
            }
            else
            {
                Calendar1.SelectedDates.Add(dt);
            }
        }
        datelist.Clear();
    }
}

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
    if (e.Day.IsSelected == true)
    {
        datelist.Add(e.Day.Date);
    }
    Session["SelectedDates"] = datelist;
}

```

ASPX

```
                                    <asp:Calendar NextPrevStyle-ForeColor="White" ClientIDMode="Static" ID="Calendar1" OnDayRender="Calendar1_DayRender" OnSelectionChanged="Calendar1_SelectionChanged" OnVisibleMonthChanged="Calendar1_VisibleMonthChanged"
                                        runat="server" BorderWidth="1px"
                                        DayNameFormat="Shortest">
                                    </asp:Calendar>

```