How to disable Calendar dates in asp.net

How to disable Calendar dates in asp.net 
The Code
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
            DateTime stratDate = new DateTime(2011, 10, 11); ;
            DateTime endDate = new DateTime(2011, 10, 21); ;

            if (e.Day.Date > stratDate && e.Day.Date < endDate)
            {
                e.Cell.Font.Italic = true;
                e.Cell.Font.Size = FontUnit.XLarge;
                e.Cell.Font.Strikeout = true;
                e.Day.IsSelectable = false;
                e.Cell.BackColor = System.Drawing.Color.DarkRed;
                e.Cell.Font.Name = "Courier New Baltic";
            }  
}
The Usage
<div>
<h2 style="color: slateblue; font-style: italic;">
How to disable Calendar dates in asp.net </h2>
<asp:calendar backcolor="White" bordercolor="White" borderwidth="1px" font-names="Verdana" font-size="9pt" forecolor="Black" height="190px" id="Calendar1" nextprevformat="FullMonth" ondayrender="Calendar1_DayRender" runat="server" width="350px">
            <dayheaderstyle font-bold="True" font-size="8pt">
            <nextprevstyle font-bold="True" font-size="8pt" forecolor="#333333" verticalalign="Bottom">
            <othermonthdaystyle forecolor="#999999">
            <selecteddaystyle backcolor="#333399" forecolor="White">
            <titlestyle backcolor="White" bordercolor="Black" borderwidth="4px" font-bold="True" font-size="12pt" forecolor="#333399">
            <todaydaystyle backcolor="#CCCCCC">
        </todaydaystyle></titlestyle></selecteddaystyle></othermonthdaystyle></nextprevstyle></dayheaderstyle></asp:calendar>
    </div>
How to disable Calendar dates in asp.net How to disable Calendar dates in asp.net Reviewed by Bhaumik Patel on 10:49 PM Rating: 5