Back to Devexpress

ASPxTreeView.ExpandToDepth(Int32) Method

aspnet-devexpress-dot-web-dot-aspxtreeview-dot-expandtodepth-x28-system-dot-int32-x29.md

latest2.4 KB
Original Source

ASPxTreeView.ExpandToDepth(Int32) Method

Expands the nodes down to the specified depth.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public void ExpandToDepth(
    int depth
)
vb
Public Sub ExpandToDepth(
    depth As Integer
)

Parameters

NameTypeDescription
depthInt32

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.

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

See Also

Expanding and Collapsing Nodes

Member Table: Expanding and Collapsing Nodes

Tree View

ASPxTreeView Class

ASPxTreeView Members

DevExpress.Web Namespace