SelectionMode Property

Sets or returns the selection mode of a Calendar object. The default value is Day.

public System.Web.UI.WebControls.CalendarSelectionMode SelectionMode {
   get,
   set
}

Exception

Exception type Condition
ArgumentException The specified value is not one of the CalendarSelectionMode values.

Remarks

The Web Forms CalendarSelectionMode enumeration provides the following selections.

Value Description
CalendarSelectionMode.Day A single date can be selected on the Calendar control.
CalendarSelectionMode.DayWeek A single date or entire week can be selected on the Calendar control.
CalendarSelectionMode.DayWeekMonth A single date, week, or entire month can be selected on the Calendar control.
CalendarSelectionMode.None No dates can be selected on the Calendar control.
Note   Avoid using this value, because some browsers still allow the user to select a date.

Example

The following example demonstrates how to use the SelectionMode property to change the calendar control to a different selection mode.

<mobile:Form id="Form1" runat=server>
  <mobile:calendar id="calendar1" SelectionMode="DayWeekMonth"
    OnSelectionChanged="Calendar_SelectionChanged" runat="server" />
</mobile:Form>   

See Also

Applies to: Calendar Class