Skip to main content
All docs
V24.1

ASPxClientGridViewCellSelectionChangingEventArgs.newSelectionState Property

Gets the new selection state of the cell.

Declaration

newSelectionState: ASPxClientGridSelectionState

Property Value

Type Description
ASPxClientGridSelectionState

One of the enumeration values.

Remarks

The following example illustrates how to prevent users from deselecting cells in the “CategoryID” column:

<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 onCellSelectionChanging(s, e) {
    if (e.cellInfo.column.fieldName == 'CategoryID') {
        if (e.newSelectionState == ASPxClientGridSelectionState.Selected) {
            // 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') {
            if (e.newSelectionState == ASPxClientGridSelectionState.Selected) {
                // your code
                e.cancel = true;
            }
        }
    }"; 
    settings.Columns.Add("CategoryID");
    ...
}).Bind(Model).GetHtml()
See Also