Saturday, January 8, 2011

How to disable particular Day of a Week in ASP.Net Calendar control?

The below little code snippet will help you to do that by using DayRender event of Calendar control.



ASPX
<asp:Calendar ID="Calendar1" runat="server" ondayrender="Calendar1_DayRender"> </asp:Calendar>

CodeBehind
  protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        if (e.Day.Date.DayOfWeek == DayOfWeek.Monday)
        {
            e.Day.IsSelectable = false;
        }
     }

No comments:

Post a Comment