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

ASPxClientGridView.SelectionChanged Event

Fires when a user selects a row.

Declaration

SelectionChanged: ASPxClientEvent<ASPxClientGridViewSelectionEventHandler<ASPxClientGridView>>

Event Data

The SelectionChanged event's data class is ASPxClientGridViewSelectionEventArgs. The following properties provide information specific to this event:

Property Description
isAllRecordsOnPage Gets whether all rows displayed within a page have been selected or unselected.
isChangedOnServer Gets whether a selection has been changed on the server.
isSelected Gets whether the row has been selected.
processOnServer Specifies whether or not to process the event on the server. Inherited from ASPxClientProcessingModeEventArgs.
visibleIndex Gets the visible index of the row whose selected state has been changed.

Remarks

The ASPxGridView provides the following ways to select/deselect multiple rows:

Use the event parameter’s processOnServer property to specify whether the grid finally processes the event on the server and fires the ASPxGridBase.SelectionChanged event or completely handles the ASPxClientGridView.SelectionChanged event on the client side without a round trip to the server.

The event’s isSelected parameter specifies whether the row is selected. To determine the selected row’s keyValue, use the GetRowKey(visibleIndex) method.

function OnSelectionChanged(s, e) {
    if (e.isSelected) {
        var key = s.GetRowKey(e.visibleIndex);
        alert('Key = ' + key);
    }
}

Note

Example

In this example, the ASPxClientGridView.SelectionChanged client-side 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:

exSelection

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