Skip to main content

ASPxClientTreeViewNode.SetExpanded(value) Method

Sets a value which specifies the node’s expansion state.

#Declaration

TypeScript
SetExpanded(
    value: boolean
): void

#Parameters

Name Type Description
value boolean

true if the node is expanded; otherwise, false.

#Remarks

Use the SetExpanded property to collapse or expand a node on the client-side. In order to determine the node’s expansion state use the ASPxClientTreeViewNode.GetExpanded method on the client side.

To learn more, see the Expanding and Collapsing Nodes topic.

#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>
See Also