asp.net - Force to select dates from a date range in a Calendar

How to force to select dates from specific date range in Calendar control
SelectDatesFromSpecificDateRangeInCalendar.aspx

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

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        SelectedDatesCollection dates = Calendar1.SelectedDates;
        DateTime startDay = new DateTime(2011, 11, 10);
        DateTime endDay = new DateTime(2011, 11, 25);
        Label1.Text = "";
        
        foreach (DateTime date in dates)
        {
            if (date > startDay & date < endDay)
            {
                Label1.Text += date.ToLongDateString() + "<br />";
            }
            else
            {
                Label1.Text ="Select dates between 2011-Nov-10 To 2011-Nov-25";
                dates.Clear();
                break;
            }
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to force to select dates from specific date range in Calendar control</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:DarkMagenta; font-style:italic;">
            How to force to select dates from 
            <br />specific date range in Calendar control
        </h2>
        <hr width="500" align="left" color="Magenta" />
        <asp:Label
            ID="Label1" 
            runat="server"
            Font-Size="Large"
            ForeColor="DarkOliveGreen"
            Font-Italic="true"
            >
        </asp:Label>
        <br />
        <asp:Calendar
            ID="Calendar1" 
            runat="server"
            NextPrevFormat="FullMonth"
            SelectionMode="DayWeekMonth"
            SelectMonthText="Month"
            SelectWeekText="Week"
            ForeColor="WhiteSmoke"
            DayNameFormat="Full"
            Font-Names="Book Antiqua"
            Font-Size="Medium"
            VisibleDate="11/1/2011"
            >
            <DayHeaderStyle
                 BackColor="SaddleBrown"
                 />
            <DayStyle
                 BackColor="Tomato"
                 BorderColor="Pink"
                 BorderWidth="1"
                 Font-Bold="true"
                 Font-Italic="true"
                 />
            <NextPrevStyle
                 Font-Italic="true"
                 Font-Names="Arial CE"
                 />
            <SelectedDayStyle
                 BackColor="OliveDrab"
                 BorderColor="Green"
                 />
            <OtherMonthDayStyle BackColor="IndianRed" />
            <SelectorStyle
                 BackColor="SaddleBrown"
                 ForeColor="Snow"
                 Font-Names="Times New Roman Greek"
                 Font-Size="Small"
                 BorderColor="SandyBrown"
                 BorderWidth="1"
                 />
            <TitleStyle
                 BackColor="DarkRed"
                 Height="35"
                 Font-Size="Large"
                 Font-Names="Courier New Baltic"
                 />
        </asp:Calendar>
        <asp:Button 
            ID="Button1"
            runat="server"
            Text="Check Selected dates between 2011-Nov-10 To 2011-Nov-25"
            Font-Bold="true"
            OnClick="Button1_Click"
            ForeColor="MidnightBlue"
            Height="46"
            />
    </div>
    </form>
</body>
</html>
More asp.net examples