Selection Modes

  • 3 minutes to read

One of the major data-processing features adopted from the ASPxGridView allows end-users to select multiple list items within a dropdown grid. The selection behavior is controlled by the ASPxGridLookup.SelectionMode property, which can be set to Single (only one item can be selected within the editor) or Multiple (multiple items can be selected within the editor).

  • The values contained in the key field (ASPxGridLookup.KeyFieldName) must be unique.
  • Setting the SelectionMode property to Multiple is not in effect if the ASPxGridViewBehaviorSettings.AllowSelectSingleRowOnly property is set to true.
  • In single-selection mode, the GridLookup always synchronizes its value with the focused row in the drop-down grid when a user sorts grid columns, navigates through pages,etc. You can press ESC to rollback a newly selected value and restore an original editor's value.

End User Item Selection

End-users can select items in different ways.

  • By clicking items within a dropdown grid.

    Note that since selection via row clicks is always available for ASPxGridLookup by design, the ASPxGridViewBehaviorSettings.AllowSelectByRowClick property (available via the GridViewProperties.SettingsBehavior property) is not in effect.

  • By clicking item check boxes within the dropdown grid.

    To display check boxes within a dropdown grid, create a specific command column and set its GridViewCommandColumn.ShowSelectCheckbox property to true.

  • By entering tags into the editor's edit box.

    This functionality is controlled by the ASPxGridLookup.TextFormatString and ASPxGridLookup.MultiTextSeparator properties. The TextFormatString property defines the pattern used to format a selected item's text for display within the editor's edit box. The MultiTextSeparator property specifies a value separator. List items (grid rows) that correspond to the tag names entered are selected automatically once the entered value has been submitted (for instance, by pressing the ENTER key or invoking the dropdown window).

How to Access the Selected Items Programmatically

ASPxGridView behavior varies based on the specified mode.

If the SelectionMode property is set to Single, you should utilize a focused row instead of a selected row. In this case, use the ASPxGridLookup.Value property on the server side and the GetValue/SetValue methods on the client side to get/set the focused row.

If the SelectionMode property is set to Multiple, you can access the selected items' values via the child ASPxGridView control's members.

To learn more, see the following Code Central example: How to use ASPxGridLookup in multiple selection mode as the ASPxGridView editor


When the Multiple selection mode is enabled, incremental filtering does not work.


The code sample below demonstrates how you can preselect some items in the ASPxGridLookup control by assigning the text of selected values to the ASPxGridLookup.Text property. Note that you should assign it according to the text format that you set in the ASPxGridLookup.TextFormatString property. The text of multiple selected rows is joined in the input using a special separator specified by the ASPxGridLookup.MultiTextSeparator property.

The image below shows the result.


<dx:ASPxGridLookup ID="gLookup" runat="server" DataSourceID="AccessDataSource1" 
     KeyFieldName="ProductID" TextFormatString="{1}" MultiTextSeparator=", " 
     ondatabound="gLookup_DataBound" SelectionMode="Multiple">
          <dx:GridViewCommandColumn ShowSelectCheckbox="True" />
          <dx:GridViewDataTextColumn FieldName="ProductID">
          <dx:GridViewDataTextColumn FieldName="ProductName">
protected void gLookup_DataBound(object sender, EventArgs e) {
     gLookup.Text = "Chai, Chang, Ikura";
See Also