Tab
A newer version of this page is available. Switch to the current version.

ASPxTreeView.ExpandToDepth(Int32) Method

Expands the nodes down to the specified depth.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

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.

Examples

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