Answer: If we want to disable the dates of other month so that those dates are not selectable .
ASPX PAGE :
<asp:Calendar runat="server" ID="Calendar1" OnDayRender="RenderDays" />
CODE BEHIND :
protected void RenderDays(object sender, DayRenderEventArgs e)
{
if (e.Day.IsOtherMonth)
{
e.Day.IsSelectable = false;
}
}
the RenderDays method that fires in OnDayRender event, we can check for the IsOtherMonth property of the day and if it is true we can set IsSelectable to false that disables the other month dates.
Asked In: While Learning |
Alert Moderator