Skip to main content

ASPxClientTreeView.CollapseAll Method

Collapses all nodes in the ASPxTreeView on the client side.


CollapseAll(): void


The CollapseAll method collapses all nodes which are currently expanded. This method invokes the ASPxClientTreeView.ExpandedChanging event before collapsing and the ASPxClientTreeView.ExpandedChanged event after collapsing.

To collapse all nodes on the server side, use the ASPxTreeView.CollapseAll method.

For more information, see the Expanding and Collapsing Nodes topic.


The code below demonstrates how you can expand and collapse all nodes on the client side.

        <dx:ASPxTreeView ID="ASPxTreeView1" runat="server" ClientInstanceName="treeview" DataSourceID="XmlDataSource1">

        <dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="CollapseAll">
            <ClientSideEvents Click="function(s, e) {treeview.CollapseAll();}" />

        <dx:ASPxButton ID="ASPxButton2" runat="server" AutoPostBack="False" Text="ExpandAll">
            <ClientSideEvents Click="function(s, e) {treeview.ExpandAll();}" />
See Also