How to disable a particular date of a month in ASP.Net Calendar Control?
At times, we may have a requirement to disable a particular date in Calendar control so that the users cannot select that date. This little code snippet will help you to do that using the DayRender event of Calendar control.
The CalendarDay object returned by DayRenderEventArgs.Day property has a property called IsSelectable which on setting false will render the date as a non clickable object in DayRender event. We can use this property and make a particular date as non selectable in Calendar control.
The below code does that,
<asp:Calendar ID="Calendar1" runat="server" ondayrender="Calendar1_DayRender"> </asp:Calendar>
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
if (e.Day.Date.ToShortDateString() == "7/27/2010")
e.Day.IsSelectable = false;
The above code will disable July 27, 2010 when rendering the Calendar control.