ASPxComboBox.SelectedIndex Property
Gets or sets the selected list item’s index.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v18.2.dll
Declaration
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.
Example
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>
...
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the SelectedIndex property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.