Calendar.SelectedDate Property

Definition

Gets or sets the currently selected date. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

public:
 property DateTime SelectedDate { DateTime get(); void set(DateTime value); };
[System.ComponentModel.Bindable(true)]
public DateTime SelectedDate { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.SelectedDate : DateTime with get, set
Public Property SelectedDate As DateTime

Property Value

The currently selected date. The default value is the value of DateTime.MinValue.

Attributes

Examples

The following code example demonstrates how to the use the SelectedDate property to refer to the selected day. This example is part of a larger code sample for the Calendar overview.

TextView1.Text = "The date you selected is " +
   Calendar1.SelectedDate.ToShortDateString();
TextView1.Text = "The date you selected is " & _
   Calendar1.SelectedDate.ToShortDateString()

Remarks

Typically, you use this property together with the SelectionMode property to determine the selected date of a Calendar control. To do this, set the SelectionMode property to Day - this setting allows only a single date selection from the Calendar control.

Browsing to the next or previous month will not update this property.

This property has the same functionality as the ASP.NET Calendar.SelectedDate property.

Applies to

See also