Compartilhar via


How to: Control User Date Selection in a Calendar Web Server Control

You can specify that users can select individual days, individual weeks, or an entire month in the Calendar control. Alternatively, you can disable day selection altogether.

To control user date selection

  • Set the Calendar control's SelectionMode property to one of the values defined in the SelectionMode enumeration: Day, DayWeek, or DayWeekMonth. To disable all date selection, set the property to None.

    Note

    Users can only select a single day, a single week, or the whole month. However, in code you can select any arbitrary set of dates. For details, see How to: Select Dates Programmatically in a Calendar Web Server Control.

When selection is enabled, the form is submitted whenever the user selects a day, week, or month, and an event is raised for which you can create a method. For details, see How to: Respond to Date Selection in a Calendar Web Server Control.

To allow the user to select a date, the calendar is displayed with links. Individual days contain a link with the date number. If you set the calendar to allow users to select a week or the whole month, an extra column with selection links is added to the left of the calendar.

Note

You can also control date selection for individual days. For example, you might specify that users can click specific days of the month, such as holidays. For details about customizing days in this way, see How to: Customize Individual Days in a Calendar Web Server Control.

You can specify the text for the week and month selection links.

See Also

Concepts

Calendar Web Server Control Overview