Selection

  • 2 minutes to read

The Bootstrap Grid View allows end-users to change selection using any of the following methods.

 

The Bootstrap Grid View supports single and multiple row selection modes. You can switch the mode using a single option. To learn more, refer to the Multiple Row Selection topic.

BootstrapGrid_Selection_Multiselect

To get the Grid View's selection, use the ASPxGridView.Selection property. The object returned by this property provides methods that allow you to select and deselect individual rows or all rows, obtain the number of selected rows, etc.

To respond to selection changes, handle the server-side ASPxGridBase.SelectionChanged event or the client-side ASPxClientGridView.SelectionChanged one.

Example

In this example, the client-side ASPxClientGridView.SelectionChanged event is handled to display selected contacts within the list box. Contact names are obtained using the ASPxClientGridView.GetSelectedFieldValues function.

The image below shows the result:

BootstrapGrid_Selection_Example

function OnGridSelectionChanged() {
    grid.GetSelectedFieldValues('ContactName', OnGridSelectionComplete);
}

function OnGridSelectionComplete(values) {
    selList.BeginUpdate();
    selList.ClearItems();
    for (var i = 0; i < values.length; i++) {
        selList.AddItem(values[i]); 
    }
    selList.EndUpdate();
}
See Also