asp.net - Programmatically select Calendar dates from a DateTime list

How to programmatically select Calendar dates from DateTime type List
SelectCalendarDatesFromDateTimeTypeList.aspx

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html>

<script runat="server">
    protected void Page_Load(object sender, System.EventArgs e)
    { 
        if(!Page.IsPostBack)
        {
            List<DateTime> dateList = new List<DateTime>();
            dateList.Add(new DateTime(2011, 11, 10));
            dateList.Add(new DateTime(2011, 11, 12));
            dateList.Add(new DateTime(2011, 11, 15));
            dateList.Add(new DateTime(2011, 11, 17));
            dateList.Add(new DateTime(2011, 11, 25));
            SelectedDatesCollection dates  = Calendar1.SelectedDates;

            for(int i=0; i <dateList.Count; i++)
            {
                dates.Add(dateList[i]);
            }
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to programmatically select Calendar dates from DateTime type List</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:SlateBlue; font-style:italic;">
            How to programmatically select
            <br /> Calendar dates from DateTime type List
        </h2>
        <hr width="450" align="left" color="SlateGray" />
        <asp:Calendar
            ID="Calendar1" 
            runat="server"
            NextPrevFormat="FullMonth"
            ForeColor="WhiteSmoke"
            SelectionMode="DayWeekMonth"
            SelectMonthText="Month"
            SelectWeekText="Week"
            DayNameFormat="Full"
            Font-Names="Book Antiqua"
            Font-Size="Medium"
            VisibleDate="11/1/2011"
            >
            <DayHeaderStyle
                 BackColor="Salmon"
                 />
            <DayStyle
                 BackColor="OliveDrab"
                 BorderColor="Olive"
                 BorderWidth="1"
                 Font-Bold="true"
                 Font-Italic="true"
                 />
            <NextPrevStyle
                 Font-Italic="true"
                 Font-Names="Arial CE"
                 />
            <SelectedDayStyle
                 BackColor="Crimson"
                 BorderColor="Orange"
                 />
            <SelectorStyle
                 BackColor="Salmon"
                 ForeColor="Snow"
                 Font-Names="Times New Roman Greek"
                 Font-Size="Small"
                 BorderColor="SandyBrown"
                 BorderWidth="1"
                 />
            <OtherMonthDayStyle BackColor="DarkOliveGreen" />
            <TodayDayStyle BackColor="DarkOrchid" />
            <TitleStyle
                 BackColor="DarkSalmon"
                 Height="36"
                 Font-Size="Large"
                 Font-Names="Courier New Baltic"
                 />
        </asp:Calendar>
    </div>
    </form>
</body>
</html>
More asp.net examples