Version

Setting Min and Max Dates for WebMonthCalendar

WebMonthCalendar™ allows you to set a range of dates you want to display in the calendar by simply setting the control’s MinDate and MaxDate properties. The end-user therefore cannot view the dates out of the range you have set on the control.

You can set the MinDate and MaxDate properties either by using the Microsoft® Visual Studio® Property Window or by using the following code:

In Visual Basic:

'Create the minimum datetime object
Dim minDate As New DateTime(2000, 1, 1)
'Create the maximum datetime object
Dim maxDate As New DateTime(2010, 1, 1)
'Assign the minimum datetime object to the WebMonthCalendar's MinDate
WebMonthCalendar1.MinDate = minDate
'Assign the maximum datetime object to the WebMonthCalendar's MaxDate
WebMonthCalendar1.MaxDate = maxDate

In C#:

//Create the minimum datetime object
DateTime minDate = new DateTime(2000, 1, 1);
//Create the maximum datetime object
DateTime maxDate = new DateTime(2010, 1, 1);
//Assign the minimum datetime object to the WebMonthCalendar's MinDate
WebMonthCalendar1.MinDate = minDate;
//Assign the maximum datetime object to the WebMonthCalendar's MaxDate
WebMonthCalendar1.MaxDate = maxDate;