ASPxClientComboBox.SetSelectedIndex(index) Method

Sets the combobox editor's selected item specified by its index.

Declaration

SetSelectedIndex(index: number): void

Parameters

Name Type Description
index number

An integer value specifying the zero-based index of the item to select.

Remarks

Use the SetSelectedIndex method on the client side to specify the selected item's index in the combobox editor. If you pass -1 as the parameter, no item is selected in the editor.

<script type="text/javascript" >
function OnClick(s, e) {
  comboBox.SetSelectedIndex(1); 
}
</script>

<dxe:ASPxComboBox ID="ASPxComboBox1" runat="server" width="200px" MaxLength="50" ClientInstanceName="comboBox">
    <Items>
        <dxe:ListEditItem Text="Contract" Value="0" />
        <dxe:ListEditItem Text="Full Time" Value="1" />
        <dxe:ListEditItem Text="Part Time" Value="2" />
    </Items>
</dxe:ASPxComboBox>

<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Select Item by Index" AutoPostBack="false">
    <ClientSideEvents Click="OnClick" />
</dx:ASPxButton>

Online Example

See Also