System.Web.UI.WebControls.DropDownList.SelectedIndex Property

Gets or sets the index of the selected item in the System.Web.UI.WebControls.DropDownList control.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.DefaultValue(0)]
public override int SelectedIndex { set; get; }

Value

a int

Remarks

Use the DropDownList.SelectedIndex property to programmatically specify or determine the index of the selected item from the System.Web.UI.WebControls.DropDownList control. An item is always selected in the System.Web.UI.WebControls.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 System.Web.UI.WebControls.DropDownList control are zero-based.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0