Saturday, January 8, 2011

How to disable to select Weekends(Saturday and Sunday) in Calendar control in asp.net?

and here is a solution for that :)


.aspx

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

Code-behind
    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        if (e.Day.IsWeekend)
        {
            e.Day.IsSelectable = false;
        }

    }

No comments:

Post a Comment