Skip to main content

ASPxClientTreeList.NodeExpanding Event

Fires before a node is expanded.


NodeExpanding: ASPxClientEvent<ASPxClientTreeListNodeEventHandler<ASPxClientTreeList>>

Event Data

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

Property Description
cancel Gets or sets a value indicating whether the action which raised the event should be canceled.
htmlEvent Provides access to the parameters associated with the ASPxClientTreeList.NodeClick and ASPxClientTreeList.NodeDblClick events.
nodeKey Gets the processed node’s key value.


Handle the NodeExpanding event to specify whether the node is allowed to be expanded. To cancel this action, set the event parameter’s cancel property to true.

This example below demonstrates how to configure the ASPxTreeList so that only one child node is expanded at a time.

function OnNodeExpanding(s, e) {
    e.cancel = true;
<dx:ASPxTreeList ID="ASPxTreeList1" runat="server" DataSourceID="AccessDataSource1"
    AutoGenerateColumns="False" KeyFieldName="EmployeeID" ParentFieldName="ReportsTo"
    <ClientSideEvents NodeExpanding="OnNodeExpanding" />
        <dx:TreeListTextColumn FieldName="LastName"/>
        <dx:TreeListTextColumn FieldName="FirstName" />
protected void ASPxTreeList1_CustomCallback(object sender, TreeListCustomCallbackEventArgs e) {
    TreeListNode node = ASPxTreeList1.FindNodeByKeyValue(e.Argument);
    while (node.ParentNode != null) {
        node.Expanded = true;
        node = node.ParentNode;

To learn more, see Expanding and Collapsing Nodes.

See Also