Thursday 17 January 2013

Disable previous dates in calendar

How to disable the past dates in calendar control.

For this you need to write following simple code on DayRender event of calendar.


 protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            if (e.Day.Date<System.DateTime.Today)
            {
                e.Cell.BackColor = System.Drawing.Color.LightGray;
                e.Day.IsSelectable = false;
            }
        }

---------------------------------------------------------------------




No comments:

Post a Comment