Answer: If we want to disable a specific date of the calendar control so that it is not selectable.
ASPX PAGE :
<asp:Calendar runat="server" ID="Calendar1" OnDayRender="RenderDays" />
CODE BEHIND :
protected void RenderDays(object sender, DayRenderEventArgs e)
{
if (e.Day.DayNumberText.Equals("25"))
{
e.Day.IsSelectable = false;
}
}
we have specified the OnDayRender event of the Calendar control that fires RenderDays sever side method. we have found out the day that needs to disable and set its IsSelectable property to false.
Asked In: While Learning |
Alert Moderator