Skip to main content

ASPxClientGridView.SelectRowsByKey(keys) Method

Selects or deselects the rows specified by their key values.


    keys: any[] | any,
    selected?: boolean
): void


Name Type Description
keys any[] | any

The key values of the rows.

selected boolean

true or undefined to select the specified row(s); false to deselect the row(s).


The SelectRowsByKey(key) method sends a callback to the server to apply the row selection.

When the row selection changes, the control raises the client-side ASPxClientGridView.SelectionChanged or the server-side ASPxGridBase.SelectionChanged event (based on the ProcessSelectionChangedOnServer property value).

For more information on row selection in grid, refer to the following topic: Selection.

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" KeyFieldName="ProductID" runat="server">
// Select a single row

// Or
grid.SelectRowsByKey(2, true);

// Deselect a single row
grid.SelectRowsByKey(2, false);

// Select multiple rows

// Or
grid.SelectRowsByKey([2,10], true);

// Deselect multiple rows
grid.SelectRowsByKey([2,10], false);

Select the Row(s) Specified by the Composite Key Value(s)

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" KeyFieldName="ProductID;ProductName" runat="server">
// Select a single row

// Or
grid.SelectRowsByKey("2|Chang", true);

// Deselect a single row
grid.SelectRowsByKey("2|Chang", false);

// Select multiple rows

// Or
grid.SelectRowsByKey(["2|Chang","10|Ikura"], true);

// Deselect multiple rows
grid.SelectRowsByKey(["2|Chang","10|Ikura"], false);
See Also