DropDownList::SelectedIndex Property
.NET Framework (current version)
Gets or sets the index of the selected item in the DropDownList control.
Assembly: System.Web (in System.Web.dll)
public: property int SelectedIndex { virtual int get() override; virtual void set(int value) override; }
Property Value
Type: System::Int32The index of the selected item in the DropDownList control. The default value is 0, which selects the first item in the list.
Use the SelectedIndex property to programmatically specify or determine the index of the selected item from the DropDownList control. An item is always selected in the DropDownList control. You cannot clear the selection from every item in the list at the same time.
Note |
|---|
The indexes for the items in the DropDownList control are zero-based. |
The following code example demonstrates how to use the SelectedIndex property to determine the selected item in the DropDownList control.
.NET Framework
Available since 1.1
Available since 1.1
Show:
