Skip to main content

ASPxClientTreeView.ExpandedChanging Event

Fires on the client side before the expansion state of a node is changed via end-user interaction.

Declaration

ExpandedChanging: ASPxClientEvent<ASPxClientTreeViewNodeCancelEventHandler<ASPxClientTreeView>>

Event Data

The ExpandedChanging event's data class is ASPxClientTreeViewNodeCancelEventArgs. 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. Inherited from ASPxClientProcessingModeCancelEventArgs.
node Gets a node object related to the event.
processOnServer Specifies whether or not to process the event on the server. Inherited from ASPxClientProcessingModeEventArgs.

Remarks

Write an ExpandedChanging event handler to perform specific actions on the client side before each time a node’s expansion state is changed via end-user interaction. You can use the event parameter’s properties to identify the node being manipulated, specify whether a postback should be generated to pass the event processing to the server side and cancel execution of the command, if necessary.

Note that if the cancel property is set to true in the event’s handler, the execution of the current command is canceled on the client side and no further processing is performed. If the command execution is not canceled (the cancel property is set to the default false value), further event processing depends upon the processOnServer property setting.

If the processOnServer property is set to false, the ExpandedChanging event is completely handled on the client side using the assigned JScript handler without a postback to the server. In this instance, processing of a node’s expansion state change proceeds with firing the client ASPxClientTreeView.ExpandedChanged event.

Setting the processOnServer property to true indicates that the final processing of the event should be performed on the server side, so a round trip to the server is required. During such a round trip, the corresponding server-side ASPxTreeView.ExpandedChanging event is fired, which when handled, allows any desired server-side action to be performed. In this instance, the server-side event processing proceeds with generating the server ASPxTreeView.ExpandedChanged event, instead of its client-side ASPxClientTreeView.ExpandedChanged equivalent.

Example

The code below demonstrates how you can prohibit end-users from collapsing any node.

protected void ASPxTreeView1_DataBound(object sender, EventArgs e) {
        ASPxTreeView1.ExpandAll();
    }
See Also