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

ASPxClientComboBox.SetText(text) Method

Specifies the text displayed within the editor’s edit box.

Declaration

SetText(
    text: string,
    applyFilter?: boolean
): void

Parameters

Name Type Description
text string

A string value specifying the editor’s text.

applyFilter boolean

true, to use the specified text as a filter and apply it to the editor, otherwise, false.

Remarks

A call to this method changes the editor’s value (selected index) and applies the specified text as a filter to the editor.

If the text passed to this method matches the text of an item from the editor’s item collection, this item is selected. The editor’s value changes to the item’s associated value. If there is no item whose associated text matches the specified text, the editor’s selected index changes to -1. In this case, the editor’s value is assigned with the text passed via the text parameter.

Note

If a callback mode is enabled (the ASPxAutoCompleteBoxBase.EnableCallbackMode property is set to true) the SetText method cannot be used to select items that are not currently displayed within the editor’s drop-down window. To learn more, see the On-Demand Item Loading (Callback Mode) topic.


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