Skip to main content
All docs
V23.2

ASPxClientGridView.CellSelectionChanging Event

Occurs when you select or deselect a cell.

Declaration

CellSelectionChanging: ASPxClientEvent<ASPxClientGridViewCellSelectionChangingEventHandler<ASPxClientGridView>>

Event Data

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

Property Description
cancel Specifies whether to cancel the related action (for example, row edit, export). Inherited from ASPxClientCancelEventArgs.
cellInfo Gets information about the cell whose selection was changed.
newSelectionState Gets the new selection state of the cell.

Remarks

ASPxGridView raises the CellSelectionChanging event when you select or deselect a cell. In this event handler, you can get the new selection state of the processed cell (e.newSelectionState) and prevent this cell selection (e.cancel).

Run Demo: GridView - Multiple Cell Selection

ASPxGridView - Select multiple cells

Web Forms:

<dx:ASPxGridView ID="GridView" runat="server" ...>
    <ClientSideEvents 
        CellSelectionChanging="onCellSelectionChange" />
    <SettingsEditing Mode="Batch">
        <BatchEditSettings EnableMultipleCellSelection="True" />
    </SettingsEditing>
    <Columns>
      <dx:GridViewDataComboBoxColumn FieldName="CategoryID" Caption="Category Name" />
      ...
    </Columns>
</dx:ASPxGridView>
function onCellSelectionChange(s, e) {
    if (e.cellInfo.column.fieldName == 'CategoryID') {
        // your code
        e.cancel = true;
    }
}

MVC:

@Html.DevExpress().GridView(settings => {
    settings.Name = "grid";
    settings.ClientSideEvents.CellSelectionChanging = "function (s, e) { 
        if (e.cellInfo.column.fieldName == 'CategoryID') {
          // your code
          e.cancel = true;
        }
    }"; 
    settings.Columns.Add("CategoryID");
    ...
}).Bind(Model).GetHtml()
See Also