System.Web.UI.WebControls.ListControl.SelectedIndex Property

Gets or sets the lowest ordinal index of the selected items in the list.

Syntax

[System.Web.UI.Themeable(false)]
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.DefaultValue(0)]
[System.ComponentModel.Browsable(false)]
[System.ComponentModel.Bindable(true)]
public virtual int SelectedIndex { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use this property to determine the index of the currently selected item in the list if the list control allows only one selection. If the list control supports multiple selections, use this property to determine the lowest index of the selected items.

The value of the ListControl.SelectedIndex property is not specifically saved on postback. It is restored on postback using the ListControl.SelectedValue property. For example, if the ListControl.SelectedValue property is 4, on postback, the ListControl.SelectedIndex property is set to the index of the System.Web.UI.WebControls.ListItem object that has a ListItem.Value property of 4. If more than one System.Web.UI.WebControls.ListItem object has a ListItem.Value property of 4, the first item in the ListControl.Items collection is selected.

This property cannot be set by themes or style sheet themes. For more information, see System.Web.UI.ThemeableAttribute and ASP.NET Themes Overview.

Requirements

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