Back to Devexpress

ASPxClientComboBox.GetSelectedIndex Method

aspnet-js-aspxclientcombobox-ece84abe.md

latest1.5 KB
Original Source

ASPxClientComboBox.GetSelectedIndex Method

Returns the index of the selected item within the combo box editor.

Declaration

ts
GetSelectedIndex(): number

Returns

TypeDescription
number

The index of the selected item.

|

Remarks

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.

js
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

GetSelectedItem

SetSelectedIndex(index)

SelectedIndex

Combo Box

ASPxClientComboBox Class

ASPxClientComboBox Members