ASPxClientTreeView.NodeClick Event
Fires on the client side after a node has been clicked.
Declaration
NodeClick: ASPxClientEvent<ASPxClientTreeViewNodeClickEventHandler<ASPxClientTreeView>>
Event Data
The NodeClick event's data class is ASPxClientTreeViewNodeClickEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
htmlElement | Gets the HTML object that contains the processed node. |
htmlEvent | Gets a DHTML event object that relates to the processed event. |
node | Gets a node object related to the event. Inherited from ASPxClientTreeViewNodeProcessingModeEventArgs. |
processOnServer | Specifies whether or not to process the event on the server. Inherited from ASPxClientProcessingModeEventArgs. |
Remarks
Write an NodeClick event handler to perform specific actions on the client side each time a node is clicked. Note that this event fires immediately after the left mouse button is released. If the button is released when the mouse pointer is not over a node, the event doesn’t fire. You can use the event parameter’s properties to identify the clicked node and specify whether a postback should be generated, to pass the event processing to the server side.
Online Example
Example
The code below shows how you can handle the client NodeClick event to expand and collapse nodes with a click.
<dx:aspxtreeview id="ASPxTreeView1" runat="server" datasourceid="XmlDataSource1">
<ClientSideEvents NodeClick="function(s, e) {
e.node.SetExpanded(!e.node.GetExpanded());
}"></ClientSideEvents>
</dx:aspxtreeview>