How do we disable the dates of other months in ASP.NET ?

 Posted by Vivek.Ramapuram on 5/19/2015 | Category: ASP.NET Interview questions | Views: 1972 | Points: 40

If we want to disable the dates of other month so that those dates are not selectable .

<asp:Calendar runat="server" ID="Calendar1" OnDayRender="RenderDays" />

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 

Comments or Responses

Login to post response