aspnet-js-aspxclientcombobox-ece84abe.md
Returns the index of the selected item within the combo box editor.
GetSelectedIndex(): number
| Type | Description |
|---|---|
| number |
The index of the selected item.
|
Use the GetSelectedIndex method to identify the editor’s selected item by its index. A value of -1 indicates that no item is currently selected within the list editor.
function onSelectedIndexChanged(sender, target) {
if (sender.PrevIndex != undefined) {
target.SetItemTooltip(sender.PrevIndex, "");
target.RemoveItemCssClass(sender.PrevIndex, "MySelectedItem");
}
target.SetItemTooltip(sender.GetSelectedIndex(), "This item is selected in another combobox");
target.AddItemCssClass(sender.GetSelectedIndex(), "MySelectedItem");
sender.PrevIndex = sender.GetSelectedIndex();
}
View Example: How to customize an item's appearance
See Also