Skip to main content
All docs
V24.1

ASPxClientTreeList.CellSelectionChanging Event

Occurs when you select or deselect a cell.

Declaration

CellSelectionChanging: ASPxClientEvent<ASPxClientTreeListCellSelectionChangingEventHandler<ASPxClientTreeList>>

Event Data

The CellSelectionChanging event's data class is ASPxClientTreeListCellSelectionChangingEventArgs. 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

ASPxTreeList 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).

ASPxGridView - Select multiple cells

Web Forms:

<dx:ASPxTreeList ID="treeList" runat="server" ...>
    <ClientSideEvents 
        CellSelectionChanging="onCellSelectionChange" />
    <SettingsEditing Mode="Batch">
        <BatchEditSettings EnableMultipleCellSelection="True" />
    </SettingsEditing>
    <Columns>
      <dx:TreListComboBoxColumn FieldName="CategoryID" Caption="Category Name" />
      ...
    </Columns>
</dx:ASPxTreeList>
function onCellSelectionChange(s, e) {
    if (e.cellInfo.column.fieldName == 'CategoryID') {
        // 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') {
          // your code
          e.cancel = true;
        }
    }"; 
    settings.Columns.Add("CategoryID");
    ...
}).Bind(Model).GetHtml()
See Also