Tab
A newer version of this page is available. Switch to the current version.

ASPxComboBox.SelectedIndex Property

Gets or sets the selected list item's index.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(-1)]
public int SelectedIndex { get; set; }
<DefaultValue(-1)>
Public Property SelectedIndex As Integer

Property Value

Type Default Description
Int32

-1

An integer value, representing the zero-based index of the selected list item.

Remarks

Use the SelectedIndex property to move selection within the combobox editor. The default value specifies that no item is selected within the editor. You can also change the selected item via the ASPxComboBox.SelectedItem property.

Handle the ASPxComboBox.SelectedIndexChanged event to respond to the selection being changed within the combobox editor.

Examples

The complete sample project is available in the DevExpress Code Central database at E124.

...
<dxe:ASPxComboBox ID="ASPxComboBox1" runat="server" SelectedIndex="1">
    <Items>
         <dxe:ListEditItem Value="" Text="(Empty)" />
         <dxe:ListEditItem Value="Some value" Text="Some value" />
    </Items>
         <ValidationSettings>
            <RequiredField IsRequired="True" ErrorText="Select not empty value." />
         </ValidationSettings>
</dxe:ASPxComboBox>
...
See Also