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

How to: Multiple Selection

  • 2 minutes to read

This example illustrates how item multi-selection can be easily implemented within ASPxGridLookup, using the corresponding functionality of a built-in grid.

In this sample, the ASPxGridLookup.SelectionMode property is set to GridLookupSelectionMode.Multiple. End-users can select items by clicking check boxes within the dropdown grid or by entering tag names separated with a semicolon into the editor’s edit box.

To display check boxes within a dropdown grid, a specific command column is created within the editor’s ASPxGridLookup.Columns collection, and the column’s GridViewCommandColumn.ShowSelectCheckbox property is set to true. In addition, end-users are allowed to filter items within the dropdown grid, because the editor’s ASPxGridViewSettings.ShowFilterRow property is set to true.

As for entering tag names into the editor’s edit box directly, this functionality is controlled by the ASPxGridLookup.TextFormatString property that defines a column (“TagName”), whose values should be entered and represented within the edit box. Symbols defined via the ASPxGridLookup.MultiTextSeparator property (“, “) are used as a value separator. List items (grid rows) that correspond to the entered tag names are selected automatically on submitting the entered value (for instance, pressing the ENTER key or invoking the dropdown window).

asp-gridlookup.png

    protected void Page_Load(object sender, EventArgs e) {
        GridLookup.GridView.Width = GridLookup.Width;
    }