System.Web.UI.WebControls Namespace TreeView Class
.NET Framework version 2.0
Sets or retrieves the number of levels that are expanded when a TreeView control is displayed for the first time.
Inline |
<asp:treeview expanddepth = intValue ... > |
Script |
TreeView.ExpandDepth [ = intValue ] |
intValue |
The depth to display when the TreeView is initially rendered. |
The property is read/write with a default value of -1, which displays all the nodes.
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.
The following example demonstrates how to use the ExpandDepth property to set the number of levels to display when the TreeView is initially rendered.
<asp:treeview id = "myTreeView" runat = "server"
datasourceid = "siteMap"
imageset = "XPFileExplorer"
showlines
expanddepth=1 />
<asp:sitemapdatasource id = "siteMap" runat = "server" />
Show me
TreeView Members