Skip to main content
All docs
V24.2

ASPxClientTreeListCellSelectionChangingEventArgs.newSelectionState Property

Gets the new selection state of the cell.

Declaration

newSelectionState: ASPxClientTreeListSelectionState

Property Value

Type Description
ASPxClientTreeListSelectionState

One of the enumeration values.

Remarks

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

<dx:ASPxTreeList ID="TreeList" runat="server" ...>
    <ClientSideEvents 
        CellSelectionChanging="onCellSelectionChange" />
    <SettingsEditing Mode="Batch">
        <BatchEditSettings EnableMultipleCellSelection="True" />
    </SettingsEditing>
    <Columns>
        <dx:TreeListComboBoxColumn 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().TreeList(settings => {
    settings.Name = "treeList";
    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