By default, the calendar displays the month containing today's date. Users can move from month to month in the Calendar Web control by clicking month navigation links (actually, LinkButton Web controls) in the title bar of the calendar. You can control whether these links are available for the user to click.
You can also navigate programmatically, which is useful if you want to provide an alternate way for users to display a specific month. Finally, you can respond to an event raised when the user navigates.
To enable or disable user month navigation
Tip You can change the appearance of the month navigation hyperlinks by setting the NextMonthText, PrevMonthText, NextPrevFormat, and NextPrevStyle properties.
To navigate months programmatically
The following example navigates to February, 2000:
[C#]
Calendar1.VisibleDate = new DateTime(2000, 2, 1);
Changing the VisibleDate property has no effect on the values of the TodaysDate, SelectedDay, or SelectedDates properties.
If month navigation is enabled, the control raises an event when the user moves to another month. You can handle this event in order to replace or amend the default month navigation. For example, if you are using two Calendar controls in a trip planning page, you can prevent the user from setting the start-date month earlier than the end-date month.
To respond to a month navigation event
The VisibleMonthChanged event takes a single argument of type MonthChangedEventArgs. You can use the following properties of this argument to determine or override what the user is doing:
See Also