Skip to main content
Tab

ASPxTreeView.ExpandToDepth(Int32) Method

Expands the nodes down to the specified depth.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public void ExpandToDepth(
    int depth
)

Parameters

Name Type Description
depth Int32

An integer value that specifies the depth level.

Remarks

The ExpandToDepth method expands all nodes within the ASPxTreeView to the specified depth.

This method invokes the ASPxTreeView.ExpandedChanging event before expanding, and the ASPxTreeView.ExpandedChanged event after expanding.

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

Example

In this example, the ExpandToDepth method expands all nodes at levels zero and one. Note, that if the ExpandToDepth method is used when the page is being loaded, call it after calling the tree list’s DataBind() method.

The image below shows the result.

TreeView - ExpandToDepth

    protected void Page_Load(object sender, EventArgs e) {
        ASPxTreeView1.DataBind();
        ASPxTreeView1.ExpandToDepth(1);
    }
See Also