Gets or sets the index of the currently selected data item.
| Visual Basic (Declaration) | |
|---|---|
Public Property SelectedIndex As Integer | |
| C# | |
|---|---|
public int SelectedIndex {get; set;} | |
Return Value
The index of the currently selected data item. If no data item is selected, -1. By default, -1.The SelectedItems, SelectedItem, and SelectedIndex properties represent data items and not DataRows.
In the case where more than 1 data item is selected in a grid, the SelectedItem property will return the first data item in the SelectedItems collection and the SelectedIndex property will return the index of this same item.
Supported Frameworks: Microsoft .NET Framework version 3.5