Calendar.SelectedDates Property
Assembly: System.Web (in system.web.dll)
public: property SelectedDatesCollection^ SelectedDates { SelectedDatesCollection^ get (); }
/** @property */ public SelectedDatesCollection get_SelectedDates ()
public function get SelectedDates () : SelectedDatesCollection
Property Value
A SelectedDatesCollection that contains a collection of System.DateTime objects representing the selected dates on the Calendar. The default value is an empty SelectedDatesCollection.Use the SelectedDates collection to determine the currently selected dates on the Calendar control.
The SelectedDate property and the SelectedDates collection are closely related. When the SelectionMode property is set to CalendarSelectionMode.Day, a mode that allows only a single date selection, SelectedDate and SelectedDates[0] have the same value and SelectedDates.Count equals 1. When the SelectionMode property is set to CalendarSelectionMode.DayWeek or CalendarSelectionMode.DayWeekMonth, modes that allows multiple date selections, SelectedDate and SelectedDates[0] have the same value.
The SelectedDates property stores a collection of System.DateTime objects.
When the user selects a week or month on the Calendar control, the SelectionChanged event is raised. The selected dates are added to the SelectedDates collection, replacing the previous contents. The range of dates are sorted in ascending order by date. The SelectedDate property is also updated to contain the first date in the SelectedDates collection.
You can also use the SelectedDates collection to programmatically select dates on the Calendar control. Use the Add, Remove, Clear, and SelectRange methods to programmatically manipulate the selected dates in the SelectedDates collection.
Note |
|---|
| Both the SelectedDate property and the SelectedDates collection are updated before the SelectionChanged event is raised. You can override the date selection by using the OnSelectionChanged event handler to manually set the SelectedDates collection. The SelectionChanged event is not raised when this collection is programmatically set. |
| Topic | Location |
|---|---|
| How to: Control Month Navigation in a Calendar Web Server Control | Building ASP .NET Web Applications |
| How to: Read Selected Dates in the Calendar Web Server Control | Building ASP .NET Web Applications |
| How to: Control Month Navigation in a Calendar Web Server Control | Building ASP .NET Web Applications |
| How to: Read Selected Dates in the Calendar Web Server Control | Building ASP .NET Web Applications |
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note