The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxClientGridView.SelectionChanged Event

Fires when a user selects a row.

Declaration

SelectionChanged: ASPxClientEvent<ASPxClientGridViewSelectionEventHandler<ASPxClientGridView>>

Event Data

The SelectionChanged event handler receives an argument of the ASPxClientGridViewSelectionEventArgs type. 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 Gets or sets a value that specifies whether the event should be finally processed on the server side.
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

Examples

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