Skip to main content
A newer version of this page is available. .

ASPxClientComboBox.SetSelectedItem(item) Method

Sets the list editor’s selected item.

Declaration

SetSelectedItem(
    item: ASPxClientListEditItem
): void

Parameters

Name Type Description
item ASPxClientListEditItem

An ASPxClientListEditItem object that specifies the item to select.

Remarks

Use the SetSelectedItem method on the client side to specify the selected item within the combobox editor. If a null value is passed as the parameter, no item will be selected within the editor.

The following example illustrates how to use the SetSelectedItem method.

function onLostFocus(s, e) {
    for (var i = 0; i < ComboBox.GetItemCount() ; i++) {
        var item = ComboBox.GetItem(i);
        if (item.GetColumnText('Text').toLowerCase() == s.GetText().toLowerCase()) {
            ComboBox.SetSelectedItem(item);
            break;
        }
    }
    if (ComboBox.GetValue() == null)
        ComboBox.SetText(s.GetText());
}
See Also