Skip to main content
All docs
V24.1

ASPxClientVerticalGridCellSelectionChangingEventArgs.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:ASPxVerticalGrid ID="VerticalGrid" runat="server" ...>
    <ClientSideEvents 
        CellSelectionChanging="onCellSelectionChange" />
    <SettingsEditing Mode="Batch">
        <BatchEditSettings EnableMultipleCellSelection="True" />
    </SettingsEditing>
    <Rows>
        <dx:VerticalGridComboBoxRow FieldName="CategoryID" Caption="Category Name" />
        ...
    </Rows>
</dx:ASPxVerticalGrid>
function onCellSelectionChanging(s, e) {
    if (e.cellInfo.column.fieldName == 'CategoryID') {
        if (e.newSelectionState == ASPxClientGridSelectionState.Selected) {
            // your code
            e.cancel = true;
        }
    }
}

MVC:

@Html.DevExpress().VerticalGrid(settings => {
    settings.Name = "verticalGrid";
    settings.ClientSideEvents.CellSelectionChanging = "function (s, e) { 
        if (e.cellInfo.row.fieldName == 'CategoryID') {
            if (e.newSelectionState == ASPxClientGridSelectionState.Selected) {
                // your code
                e.cancel = true;
            }
        }
    }"; 
    settings.Rows.Add("CategoryID");
    ...
}).Bind(Model).GetHtml()
See Also