TreeView.ExpandDepth Property

Definition

Gets or sets the number of levels that are expanded when a TreeView control is displayed for the first time.

C#
[System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.TreeView+TreeViewExpandDepthConverter))]
public int ExpandDepth { get; set; }

Property Value

The depth to display when the TreeView is initially displayed. The default is -1, which displays all the nodes.

Attributes

Remarks

Use the ExpandDepth property to control the rendering of the TreeView control the first time that it is displayed. On subsequent postbacks, the nodes retain their current expanded state.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also