Skip to main content

ASPxClientTreeView.CollapseAll Method

Collapses all nodes in the ASPxTreeView on the client side.

Declaration

CollapseAll(): void

Remarks

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.

Example

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:ASPxTreeView>

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

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