SelectionList.SelectedIndex Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the index of the selected item. The default value is -1. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.
public:
property int SelectedIndex { int get(); void set(int value); };
[System.ComponentModel.Bindable(false)]
[System.ComponentModel.Browsable(false)]
public int SelectedIndex { get; set; }
[<System.ComponentModel.Bindable(false)>]
[<System.ComponentModel.Browsable(false)>]
member this.SelectedIndex : int with get, set
Public Property SelectedIndex As Integer
Property Value
The index of the selected item.
- Attributes
Exceptions
an attempt was made to set the SelectedIndex property to less than -1
or greater than or equal to the number of items.
Remarks
If the control is in multiple selection mode, this property returns the index of the first selected item. The selected index cannot be set declaratively; use the Selected property of a list item instead. Set the SelectedIndex to -1 to clear the selection. This is useful when you want to dynamically remove items from the list.