Calendar::SelectedDate Property
Gets or sets the selected date.
Assembly: System.Web (in System.Web.dll)
[BindableAttribute(true, BindingDirection::TwoWay)] public: property DateTime SelectedDate { DateTime get (); void set (DateTime value); }
<asp:Calendar SelectedDate="DateTime" />
Property Value
Type: System::DateTimeA System::DateTime that represents the selected date. The default value is DateTime::MinValue.
Use the SelectedDate property to determine the selected date 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 SelectedDate property is set using a System::DateTime object.
When the user selects a date on the Calendar control, the SelectionChanged event is raised. The SelectedDate property is updated to the selected date. The SelectedDates collection is also updated to contain just this date.
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 SelectedDate property. The SelectionChanged event does not get raised when this property is programmatically set. |
| Topic | Location |
|---|---|
| How to: Set Today's Date Programmatically 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: Set Today's Date Programmatically 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 |
| Walkthrough: Creating a Basic Web Page in Visual Web Developer | Building ASP .NET Web Applications in Visual Studio |
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note: