TreeView class properties and its descriptions

Web developers use the TreeView control to display hierarchical data, in a tree structure, such as a table of contents or file directory. The TreeView control can be used inside an UpdatePanel only when EnableClientScript is set to true. By using UpdatePanel controls selected regions of a Web page can be updated instead of the whole page with a postback.

The following features are supported by the control:

– Data binding that allows the nodes of the control to be bound to XML, tabular, or relational data.
– Site navigation through integration with the SiteMapDataSource control.
– Node text that can be displayed as either plain text or hyperlinks.
– Programmatic access to the TreeView object model to create trees, populate nodes, set properties, and so on dynamically.
– Client-side node population (on supported browsers).
– The ability to display a check box next to each node.
– Customizable appearance through themes, user-defined images, and styles.

TreeView nodes

The TreeView control is made up entries, represented by a TreeNode object, called nodes. Node types are defined as follows:

– A node that contains other nodes is called a parent node.
– The node that is contained by another node is called a child node.
– A node that has no children is called a leaf node.
– The node that is not contained by any other node but is the ancestor to all the other nodes is the root node.

A node can be both a parent and a child, but root, parent, and leaf nodes are mutually exclusive. Several visual and behavioral properties of nodes are determined by whether a node is a root, parent, or leaf node.

Although a typical tree structure has only one root node, the TreeView control supports multiple root nodes. This is useful when Web developer wants to display item listings without displaying a single root node, as in a list of product categories.

Each node has two properties: Text and Value. The value of the Text property is displayed in the TreeView, while the Value property is used to store any additional data about the node, such as data that is passed to the postback event that is associated with the node. A node can be in one of two modes: selection (by default) mode and navigation mode. Web developer can put a node into navigation mode, by setting the NavigateUrl property for the node to a value other than an empty string (“”).

Note: Some Internet browsers have a limitation that can affect the performance of the TreeView control. If the number of characters in a URL of a node is larger than determined limit number, expanding that node will fail and no exception is thrown.

TreeView control and static Data

Static data is the simplest data model of the TreeView control. Web developer can display static data using declarative syntax, by nesting opening and closing <Nodes> tags between the opening and closing tags of the TreeView control. As a next step he/she should the tree structure by nesting <asp:TreeNode> elements between the opening and closing <Nodes> tags where <asp:TreeNode> element represents a node in the tree and maps to a TreeNode object. Web developer can set the properties of each node by setting the attributes of its <asp:TreeNode> element. To create child nodes, Web developers should nest additional <asp:TreeNode> elements between the opening and closing <asp:TreeNode> tags of the parent node.

TreeView control and Data bindings

Web developers can use one of two methods to bind the TreeView control to the appropriate data source type:

– The TreeView control can use any data source control that implements the IHierarchicalDataSource interface, such as XmlDataSource control or a SiteMapDataSource control, by setting the DataSourceID property of the control to the ID value of the data source control. In this case the TreeView control automatically binds to the specified data source control. This is the preferred method to bind to data.
– The TreeView control can be bound to an XmlDocument object or a DataSet object with relations by setting the DataSource property of the control to the data source, and then call the DataBind method.
When binding to a data source where each data item contains multiple properties (such as an XML element with several attributes), a node displays the value that is returned by the ToString method of the data item, by default. In the case of an XML element, the node displays the element name, which shows the underlying structure of the tree but is not very useful otherwise. Web developer can bind a node to a specific data item property by specifying tree node bindings using the DataBindings collection which contains TreeNodeBinding objects that define the relationship between a data item and the node that it is binding to. Web developer can determine the criteria for binding and the data item property to display in the node.

Note: A malicious user can create a callback request and get data for the nodes of the TreeView control that the Web page developer is not displaying. Therefore, security of the data must be implemented by the data source. Web developers must not use the MaxDataBindDepth property to hide data.

TreeView control and dynamic Node population

The TreeView control supports dynamic node population at run time when the node is expanded, by setting the PopulateOnDemand property for a node to true. To populate a node dynamically, Web developer must define an event-handling method that contains the logic to populate a node for the TreeNodePopulate event. Browsers that support callback scripts can also take advantage of client-side node population. Client-side node population enables the TreeView control to populate a node using client script when users expand the node, without requiring a round trip to the server.

TreeVew control and user interface

Web developers can customize the appearance of the TreeView control, by following different ways:

– They can specify a different style for each of the node types
– They can use cascading style sheets (CSS) as inline styles or as a separate CSS file, but not both. Possible node styles are the following:

  • HoverNodeStyle – The style settings for a node when the mouse pointer is positioned over it.
  • LeafNodeStyle – The style settings for the leaf nodes.
  • NodeStyle – The default style settings for a node.
  • ParentNodeStyle – The style settings for the parent nodes.
  • RootNodeStyle – The style settings for the root nodes.
  • SelectedNodeStyle – The style settings for a selected node.

– They can control the style of nodes at specific depths within the tree by using the LevelStyles collection. The first style in the collection corresponds to the style of the nodes at the first level in the tree. The second style in the collection corresponds to the style of the nodes at the second level in the tree, and so on. This is most often used to generate table of contents–style navigation menus where nodes at a certain depth should have the same appearance, regardless of whether they have child nodes. Style properties are applied in the following order:

  1. NodeStyle.
  2. RootNodeStyle, ParentNodeStyle, or LeafNodeStyle, depending on the node type. If the LevelStyles collection is defined, it is applied at this time, overriding the other node style properties.
  3. SelectedNodeStyle
  4. HoverNodeStyle.

– They can customize the images that are displayed in the TreeView control, but Web developers do not need to customize every image property. If an image property is not explicitly set, the built-in default image is used They can determine their set of images for the different parts of the control by setting the following properties:

  • CollapseImageUrl – The URL to an image displayed for the collapsible node indicator. This image is usually a (-) sign.
  • ExpandImageUrl – The URL to an image displayed for the expandable node indicator. This image is usually a (+) sign.
  • LineImagesFolder – The URL to the folder containing the line images used to connect parent nodes to child nodes. The ShowLines property must also be set to true for this property to have an effect.
  • NoExpandImageUrl – The URL to an image displayed for the non-expandable node indicator.

– The TreeView control also allows to display a check box next to a node. When the ShowCheckBoxes property is set to a value other than TreeNodeTypes.None, check boxes are displayed next to the specified node types. Note: The ShowCheckBoxes property can be set to a bitwise combination of the TreeNodeTypes enumeration member values. Each time the page is posted to the server, the CheckedNodes collection is automatically populated with the selected nodes. When check boxes are displayed, Web developer can use the TreeNodeCheckChanged event to run a custom routine whenever the state of a check box changes between posts to the server.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)

PropertyDescriptionSupported in .NET version
AccessKeyThis property returns or sets the access key that allows software developer to quickly navigate to the Web server control.1.0,1.1, 2.0, 3.0, 3.5, 4.0
AdapterThis property gets the browser-specific adapter for the control.2.0, 3.0, 3.5, 4.0
AppRelativeTemplateSourceDirectory 

 

Software developer can use this property to set or get the application-relative path to the page or user control that contains the current control. If the web page is installed in http://www.somesite.com/apps/application1 the property will return “~/application1”.2.0, 3.0, 3.5, 4.0
AttributesThis property is a collection which contains a collection of all attributes declared in the opening tag of a Web server control. Software developer can control programmatically the attributes associated with a Web server control. He/she can add or remove attributes to/from the collection.1.0,1.1, 2.0, 3.0, 3.5, 4.0
AutoGenerateDataBindingsThis property gets or sets a value indicating whether the TreeView control automatically generates tree node bindings. Tree node bindings define the relationship between a data item and the node it is binding to. When binding to a data source where each data item contains multiple properties (such as an XML element with several attributes), the TreeView control needs to know which data item property to bind to which TreeNode property. When this property is set to true (its default value), the control automatically generates default tree node bindings that set the Text property of the TreeNode object that is associated with the binding to the value that is returned by the ToString method of the data item.2.0, 3.0, 3.5, 4.0
BackColorThe property is used to specify the background color of the Web server control. Software developer can set it using a System.Drawing..::.Color object.1.0,1.1, 2.0, 3.0, 3.5, 4.0
BindingContainerSoftware developer can’t use this property directly from his/her code, because it supports the .NET Framework infrastructure. The property contains a reference to the Control object which contains data-binding information for the current control.1.0,1.1, 2.0, 3.0, 3.5, 4.0
BorderColorThe property is used to specify the border color of the Web server control. Software developer can set it using a System.Drawing..::.Color object.1.0,1.1, 2.0, 3.0, 3.5, 4.0
BorderStyleSpecifies the type of the control’s border. Software developer can choose one of the values from the BorderStyle enumeration – Dashed, Dotted, Double, Grrove, Ridge, Inset, Outset, Solid and None.1.0,1.1, 2.0, 3.0, 3.5, 4.0
BorderWidthSpecifies the size of the control’s border. When software developer sets this property he/she should use combination of a numeric value followed by type of measurement: px (for pixels) or % (for percentage) and so on.1.0,1.1, 2.0, 3.0, 3.5, 4.0
CheckedNodesThis property returns a collection of TreeNode objects that represent the nodes in the TreeView control that display a selected check box. This collection is commonly used to iterate through all the nodes that have a selected check box in the tree. Note: The CheckedNodes collection is populated using a depth-first traversal of the tree structure: each parent node is processed down to its child nodes before the next parent node is populated. 

The TreeNodeCheckChanged event is raised when the check boxes of the TreeView control change state between posts to the server. This allows Web developer to provide an event-handling method that performs a custom routine, such as updating a database or the displayed content, whenever this event occurs.

2.0, 3.0, 3.5, 4.0
ChildControlsCreatedGets a true value that indicates whether the server control’s child controls have been created.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ClientIDReturns the server control identifier generated by ASP.NET. The ClientID value is generated by concatenating the ID value of the control and the UniqueID value of its parent control. If the ID value of the control is not specified, an automatically generated value is used. Each part of the generated ID is separated by an underscore character (_).1.0,1.1, 2.0, 3.0, 3.5, 4.0
ClientIDSeparatorThe ClientID value is generated by concatenating the ID value of the control and the UniqueID value of its parent control. Each part of the generated ID property is separated by the ClientIDSeparator property value. The value always returns an underscore (_).1.0,1.1, 2.0, 3.0, 3.5, 4.0
CollapseImageToolTipThis property gets or sets the ToolTip for the image that is displayed for the collapsible node indicator. The value of this property is stored in view state.2.0, 3.0, 3.5, 4.0
CollapseImageUrlThis property gets or sets the URL to a custom image for the collapsible node indicator. Its default value is an empty string (“”), which displays the default minus sign (-) image. Web developer can specify custom images by first setting the ImageSet property to TreeViewImageSet.Custom, and then setting the NoExpandImageUrl, ExpandImageUrl, and CollapseImageUrl properties to the URLs for the custom images (which must have the same dimensions). If no images are specified, the default images are used. To hide the expansion node indicators, Web developers should set the ShowExpandCollapse property to false. The value of this property is stored in view state.2.0, 3.0, 3.5, 4.0
ContextSoftware developer can use this property to access the HttpContext object for the current Web request. Using properties of the object software developer can access objects Application, Session, Request, Response, etc. which contain information about the current HTTP request. The object provides methods that allow him to get configuration information and to set or clear errors related to the request.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ControlsThis property allows software developer to access programmatically to the instance of the ControlCollection class for any server control. Using it he/she can add/remove controls to/from the collection or iterate through the server controls in the collection.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ControlStyleThis property is used to encapsulate all properties of the WebControl class that specify the appearance of the control, such as BorderColor and Font. This property is used primarily by control developers.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ControlStyleCreatedThis property is used primarily by control developers. Returns a true value if a Style object has been created for the ControlStyle property; otherwise false.1.0,1.1, 2.0, 3.0, 3.5, 4.0
CssClassSoftware developer can use this property to specify the CSS class to render on the client for the Web Server control. This property will render on browsers for all controls. On browsers that do not support CSS, setting the CssClass property will have no effect.1.0,1.1, 2.0, 3.0, 3.5, 4.0
DataBindingsReturns a collection of TreeNodeBinding objects that define the relationship between a data item and the node that it is binding to.2.0, 3.0, 3.5, 4.0
DataSourceThis property gets or sets the object from which the data-bound control retrieves its list of data items. Its default value is a null reference (Nothing in VB.NET). When Web developer sets the DataSource property, the ValidateDataSource method is called. In addition, if the data-bound control has already been initialized, the OnDataPropertyChanged method is called to set the RequiresDataBinding property to true. This property cannot be set by themes or style sheet themes.2.0, 3.0, 3.5, 4.0
DataSourceIDThis property overwrites BaseDataBoundControl.DataSourceID. Web developer can use it to get or set the ID of the control from which the data-bound control retrieves its list of data items. Its default value is String.Empty.2.0, 3.0, 3.5, 4.0
DesignModeThis property returns true to indicate that the control is being used in the context of a designer. Software developer’s custom controls can use this property when design-time behavior is different than run-time behavior.2.0, 3.0, 3.5, 4.0
EnableClientScriptThis property is used to get or set a value indicating whether the TreeView control renders client-side script, on compatible browsers, to handle expanding and collapsing events. When this property is set to true (by default), compatible browsers execute the code to expand and collapse nodes on the client. The tree node data must be known in advance for the client-side script to work. Using client script prevents a post back to the server each time a node is expanded or collapsed. When the tree node data is not known in advance, nodes can be populated from the client, if the PopulateNodesFromClient property is also set to true. In this scenario, Web developers must also provide an event-handling method for the TreeNodePopulate event to populate the nodes. Note: If the EnableClientScript property is set to false, the TreeView control posts back to the server each time a node is expanded or collapsed.2.0, 3.0, 3.5, 4.0
EnabledSoftware developer should set this property to true when he/she wants to specify or determine whether a control is functional. When developer sets to false, the control appears dimmed, preventing any input from being entered in the control. Notes: 

    -Not all browsers support this property. Dimming and locking the control only works in browsers that are compatible with Microsoft Internet Explorer version 4 and later.
    -In a custom composite control, this behavior does not apply to controls that have not yet created their child controls.
    -A disabled control can support postbacks. It is possible for a user who is viewing the page with a disabled control to craft a request that submits a postback that is processed by the page.
1.0,1.1, 2.0, 3.0, 3.5, 4.0
EnableThemingThis property overrides Control. EnableTheming. 

The property indicates whether themes are enabled for a specified control. When the property’s value is true, the application’s theme directory is searched for control skins to apply. If for the particular control skin does not exist in the directory, skins are not applied. When the property’s value is false, the theme directory is not searched and the contents of the SkinID property are not used.

2.0, 3.0, 3.5, 4.0
EnableViewStateSoftware developer must enable view state for the server control setting its value to true if he/she wants to maintain its state across HTTP requests. Sometimes is better to set value of this property to false if for example Web application is loading a database request into a server control. In this case application performance will be improved.1.0,1.1, 2.0, 3.0, 3.5, 4.0
EventsThis read-only property returns a list of event handler delegates for the control. The type of this property is EventHadlerList, which uses a linear search algorithm to find entries in the list of delegates. When the list of delegates is large, finding entries with this property will be slow, because a linear search algorithm is inefficient when working with a large number of entries.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ExpandDepthThis property gets or sets the number of levels that are expanded when a TreeView control is displayed for the first time. Its default value is -1, which displays all the nodes.2.0, 3.0, 3.5, 4.0
ExpandImageToolTipThis property is used to get or set the ToolTip for the image that is displayed for the expandable node indicator. The value of this property is stored in view state.2.0, 3.0, 3.5, 4.0
ExpandImageUrlThis property is used to get or set the URL to a custom image for the expandable node indicator. Its default value is an empty string (“”), which displays the default plus sign (+) image. Web developers can specify custom images by first setting the ImageSet property to TreeViewImageSet.Custom, and then setting the NoExpandImageUrl, ExpandImageUrl, and CollapseImageUrl properties to the URLs for the custom images (which must have the same dimensions). If no images are specified, the default images are used. To hide the expansion node indicators, Web developers should set the ShowExpandCollapse property to false. The value of this property is stored in view state.2.0, 3.0, 3.5, 4.0
FontSoftware developer can use this property to specify the font properties of the Web Server control. This property includes subproperties that can be accessed declaratively in the form of Property-Subproperty (for example Font-Bold) or programmatically in the form of Property.Subproperty (for example Font.Bold). 

All but one subproperty will render in browsers prior to Microsoft Internet Explorer version 4 for all controls. They are: Bold, Italic, Name, Names, Strikeout, Underline, and Size (but only named font sizes, such as Small, Smaller, and so on, will work).

1.0,1.1, 2.0, 3.0, 3.5, 4.0
ForeColorSoftware developer can use this property to to specify the foreground color of the Web server control. The foreground color is usually the color of the text. This property will render on browsers earlier than Microsoft Internet Explorer version 4 for all controls, except the Image, AdRotator, HyperLink and LinkButton.1.0,1.1, 2.0, 3.0, 3.5, 4.0
HasAttributesThis property returns true when the WebControl instance has attribute name/value pairs. The attribute pairs can be set either in the property or in the view state.2.0, 3.0, 3.5, 4.0
HasChildViewStateSoftware developer can use this property to verify that any child controls of the server control are storing view-state information. Using it in this way he/she can avoid unnecessary calls to the ClearChildViewState method.1.0,1.1, 2.0, 3.0, 3.5, 4.0
HeightThis property is used to specify the height of the Web server control. When software developer sets this property he/she should use combination of a numeric value followed by type of measurement: px (for pixels) or % (for percentage) and so on.This property does not render for all controls in browsers earlier than Microsoft Internet Explorer version 4. Controls that do not render this property in earlier browsers include Label, HyperLink, LinkButton, and any validation controls. The CheckBoxList, RadioButtonList and DataList also do not render this property in earlier browsers when their RepeatLayout property is set to RepeatLayout.Flow. Furthermore, only unit types of Pixel and Percentage are supported in earlier browsers.1.0,1.1, 2.0, 3.0, 3.5, 4.0
HoverNodeStyleReturns a reference to the TreeNodeStyle object that allows Web developer to set the appearance of a node when the mouse pointer is positioned over it. Note: To use the HoverNodeStyle property, Web developer must include a <head> element with a runat=”server” attribute.2.0, 3.0, 3.5, 4.0
IDWeb developers can set this property by declaring ID attribute in the opening tag of an ASP.NET server control. Another possible way to set it is programmatically. If this property is not specified for a server control, either declaratively or programmatically, Web developer can obtain a reference to the control through its parent control’s Controls property.1.0,1.1, 2.0, 3.0, 3.5, 4.0
IdSeparatorSoftware developer can’t use this property directly from his/her code, because it supports the .NET Framework infrastructure. The character contained in this property ( by default $ ) is used to separate the control identifiers for child controls. The ID separator character is appended to the ID property.2.0, 3.0, 3.5, 4.0
ImageSetThis property gets or sets the group of images to use for the TreeView control. Web developer can either select a predefined set of images to give the control a standard look or define his/her own custom set. The valid values of this property are: 

    -TreeViewImageSet.Arrows – A predefined image set that uses arrow images.
    -TreeViewImageSet.BulletedList – A predefined image set that uses diamond-shaped bullet images.
    -TreeViewImageSet.BulletedList2 – A predefined image set that uses square-shaped bullet images.
    -TreeViewImageSet.BulletedList3 – A predefined set of sectioned, diamond shaped bullet images.
    -TreeViewImageSet.BulletedList4 – A predefined set of alternate sectioned, diamond shaped bullet images in sizes that vary by level.
    -TreeViewImageSet.Contacts – A predefined image set that uses MSN Messenger images.
    -TreeViewImageSet.Custom – A user-defined image set.
    -TreeViewImageSet.Events – A predefined image set that uses event log-styled images.
    -TreeViewImageSet.Faq – A predefined image set that uses FAQ-styled images.
    -TreeViewImageSet.Inbox – A predefined image set that uses e-mail-styled images.
    -TreeViewImageSet.News – A predefined image set that uses newsgroup-styled images.
    -TreeViewImageSet.Simple – A predefined image set that uses simple shape outlines.
    -TreeViewImageSet.Simple2 – A predefined image set that uses simple filled shapes.
    -TreeViewImageSet.Msdn – A predefined image set that uses MSDN images.
    -TreeViewImageSet.WindowsHelp – A predefined image set that uses Microsoft Windows Help images.
    -TreeViewImageSet.XPFileExplorer – A predefined image set that uses Windows Explorer images available in Microsoft Windows XP.
2.0, 3.0, 3.5, 4.0
InitializedReturns a true value indicating whether the data-bound control has been initialized. The ConfirmInitState and OnPagePreLoad methods both explicitly set the Initialized property to true. The ConfirmInitState method is called by the DataBoundControl.OnLoad method, while OnPagePreLoad is called when the PreLoad event is raised.2.0, 3.0, 3.5, 4.0
IsBoundUsingDataSourceIDReturns a value true indicating whether the DataSourceID property is set value other than String.Empty. Controls such as GridView, DetailsView, FormView, and Menu use the IsBoundUsingDataSourceID property to determine whether the data-bound control is bound to an ASP.NET 2.0 data source control, such as an ObjectDataSource or SqlDataSource.2.0, 3.0, 3.5, 4.0
IsChildControlStateClearedThis property has value true if children of this control do not use control state; otherwise, false.2.0, 3.0, 3.5, 4.0
IsEnabledThis property returns true if the Enabled property is true for this control and any containing controls.2.0, 3.0, 3.5, 4.0
IsTrackingViewStateThis property returns value true if the control is marked to save changes to its view state; otherwise, false. 

 

1.0,1.1, 2.0, 3.0, 3.5, 4.0
IsViewStateEnabledThis property returns value true if view state is enabled for the control; otherwise false. View state can be enabled at the page, container, or control level. When view state is disabled at the page or container level, view state is disabled for all controls contained by the page or container. The property indicates whether view state is enabled by pages, containers, or controls. In some cases it is possible values for the EnableViewState property and the IsViewStateEnabled property to be different. For example, if the Page containing the control has view state disabled, the EnableViewState property can be true while the IsViewStateEnabled property is false. Notes: Developers will set the EnableViewState property to indicate whether they are using view state with your control. Web developers can use this property in their code to determine whether view state is enabled for their control and all containers.2.0, 3.0, 3.5, 4.0
LeafNodeStyleReturns a reference to the TreeNodeStyle object that allows you to set the appearance of leaf nodes.2.0, 3.0, 3.5, 4.0
LevelStylesReturns a collection of Style objects that represent the node styles at the individual levels of the tree.2.0, 3.0, 3.5, 4.0
LineImagesFolderThis property gets or sets the path to a folder that contains the line images that are used to connect child nodes to parent nodes. Its default value is an empty string (“”), which indicates that the LineImagesFolder property is not set. The TreeView control can display lines that connect child nodes to parent nodes when the ShowLines property is set to true. When lines are displayed, Web developer should use the LineImagesFolder property to specify a Web-accessible folder that contains the set of pre-rendered images to use for the lines: 

    -Dash.gif – A line image displayed next to the root node when there is only one root node in the tree structure and the root node is a leaf.
    -Dashplus.gif – A plus sign (+) image displayed next to the root node when there is only one root node in the tree structure to indicate that the root node is collapsed.
    -Dashminus.gif – A minus sign (-) image displayed next to the root node when there is only one root node in the tree structure to indicate that the root node is expanded.
    -I.gif – A line image displayed to connect adjacent nodes.
    -L.gif – A line image displayed next to the last node in a branch when the node is a leaf.
    -Lminus.gif – A line image displayed next to the last node in a branch to indicate that the node is expanded.
    -Lplus.gif – A line image displayed next to the last node in a branch to indicate that the node is collapsed.
    -Minus.gif – A minus sign (-) image displayed next to the first root node in a tree structure that contains multiple root nodes to indicate that the node is expanded. This image does not contain an extra line and is displayed only after the root node has been collapsed once. When the page is first loaded, the Rminus.gif image is displayed.
    -Noexpand.gif – A blank spacer image displayed next to a leaf node. This image allows text to line up vertically.
    -Plus.gif – A plus sign (+) image displayed next to the first root node in a tree structure that contains multiple root nodes to indicate that the node is collapsed. This image does not contain an extra line and is displayed only after the root node has been expanded once. When the page is first loaded, the Rplus.gif image is displayed.
    -R.gif – A line image displayed next to the first root node in a tree structure that contains multiple root nodes to indicate that the node is a leaf node.
    -Rminus.gif – A minus sign (-) image displayed next to the first root node in a tree structure that contains multiple root nodes to indicate that the node is expanded. This image contains an extra line and is displayed only when the page is first loaded. After the root node has been collapsed once, The Minus.gif image is displayed.
    -Rplus.gif – A plus sign (+) image displayed next to the first root node in a tree structure that contains multiple root nodes to indicate that the node is collapsed. This image contains an extra line and is displayed only when the page is first loaded. After the root node has been expanded once, the Plus.gif image is displayed.
    -T.gif – A line image displayed next to a node in the middle of the tree structure (at a t-intersection) to indicate that the node is a leaf.
    -Tminus.gif – A minus sign (-) image displayed next to a node in the middle of the tree structure (at a t-intersection) to indicate that the node is expanded.
    -Tplus.gif – A plus sign (+) image displayed next to a node in the middle of the tree structure (at a t-intersection) to indicate that the node is collapsed.

Note: If the LineImagesFolder property is not set, the TreeView control will use the built-in, default images (20 x 20 pixels). The value of this property is stored in view state.

2.0, 3.0, 3.5, 4.0
LoadViewStateByIDThis property returns value true if the control loads its view state by ID; otherwise, false. Its default value is false.2.0, 3.0, 3.5, 4.0
MaxDataBindDepthThis property gets or sets the maximum number of tree levels to bind to the TreeView control. Its default value is -1, which binds all the tree levels in the data source to the control.2.0, 3.0, 3.5, 4.0
NamingContainerUsing this property software developer can get a reference to the server control’s naming container, which creates a unique namespace for differentiating between server controls with the same Control.ID property value.1.0,1.1, 2.0, 3.0, 3.5, 4.0
NodeIndentThis property is used to get or set the indentation amount (in pixels) for the child nodes of the TreeView control. Its default value is 20 and the value of this property is stored in view state. Note: The NodeIndent property affects every child node in the TreeView control. It is not possible to control the indentation amount of each node individually.2.0, 3.0, 3.5, 4.0
NodesReturns a collection of TreeNode objects that represents the root nodes in the TreeView control. Note: A typical tree structure has only one root node; however, you can add multiple root nodes to the TreeView control.2.0, 3.0, 3.5, 4.0
NodesStyleReturns a reference to the TreeNodeStyle object that allows Web developers to set the default appearance of the nodes in the TreeView control. Note: The corresponding node style settings in the RootNodeStyle, ParentNodeStyle, or LeafNodeStyle properties override the style settings of the NodeStyle property.2.0, 3.0, 3.5, 4.0
NodeWrapThis property gets or sets a value indicating whether text wraps in a node when the node runs out of space. Its default value is false, i.e. the text is not wrapped. The value of this property is stored in view state.2.0, 3.0, 3.5, 4.0
NoExpandImageUrlThis property gets or sets the URL to a custom image for the non-expandable node indicator. Its default is an empty string (“”), which displays the default blank image. The value of this property is stored in view state. Note: To ensure that nodes align correctly in the TreeView control when using custom images, all the images that are specified by the NoExpandImageUrl, ExpandImageUrl, and CollapseImageUrl properties should have the same dimensions.2.0, 3.0, 3.5, 4.0
PageProvides a reference to the web page that contains this control as a System.Web.UI.Page object. This property’s value reflects the name of the .aspx file that contains the server control.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ParentThis property provides a reference to the control that contains this control. If the control is placed on the page directly (rather than inside another control), it will return a reference to the page object.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ParentNodeStyleThis property returns a reference to the TreeNodeStyle object that allows you to set the appearance of parent nodes in the TreeView control.2.0, 3.0, 3.5, 4.0
PathSeparatorThis property gets or sets the character that is used to delimit the node values that are specified by the ValuePath property. Its default value is a slash mark (/).The value of this property is stored in view state.2.0, 3.0, 3.5, 4.0
PopulateNodesFromClientThis property (with default value true) is used to get or set a value indicating whether node data is populated on demand from the client. The TreeView control supports dynamic node population, because it is not practical to statically predefine the tree structure due to data size or custom content that depends on user input. When the PopulateOnDemand property for a node is set to true, that node gets populated at run time when the node is expanded. When the PopulateNodesFromClient property is set to true, a service is called from the client to populate the tree nodes, which eliminates the need to post back to the server. 

Note: The EnableClientScript property must also be set to true in order for the PopulateNodesFromClient property to be set to true.

To populate a node on the client, Web developer should:

    1.Set the PopulateNodesFromClient property to true
    2.Set the PopulateOnDemand property for the node to true.
    3.Define an event-handling method for the TreeNodePopulate event that programmatically populates the node. A typical event-handling method retrieves node data from a data source, places the data into a node structure, and then adds the node structure to the ChildNodes collection of the node being populated. Web developer can create a node structure by adding TreeNode objects to the ChildNodes collection of a parent node.

Note: When the PopulateOnDemand property for a node is set to true, the node must be populated dynamically. Web developer cannot nest another node below it; otherwise, an error will occur on the page.

Note: The client-side node population feature is supported in browsers that support callback scripts. To check whether a browser supports callback scripts access, Web developers should use the SupportsCallback property of the HttpBrowserCapabilities class. They can access the instance of the HttpBrowserCapabilities class for the current request through the Browser property of the HttpRequest class.

The value of this property is stored in view state.

2.0, 3.0, 3.5, 4.0
RequiresDataBindingThis property is used to get or set a value indicating whether the DataBind method should be called. The returned value is true if the data-bound control’s DataBind method should be called before the control is rendered. If Web developer set the property to true when the data-bound control has already begun to render its output to the page, the current HTTP request is not a callback, and he/she should use the DataSourceID property to identify the data source control to bind to, the DataBind method is called immediately. In this case, the RequiresDataBinding property is not actually set to true.2.0, 3.0, 3.5, 4.0
RootNodeStyleReturns a reference to the TreeNodeStyle object that allows Web developer to set the appearance of the root node in the TreeView control.2.0, 3.0, 3.5, 4.0
SelectedNodeReturns a TreeNode object that represents the selected node in the TreeView control. 

Note: A node cannot be selected when the TreeView control displays hyperlinks, because the SelectedNode property always returns a null reference (Nothing in VB.NET).

When the user selects a different node in the TreeView control by clicking the text in the new node, the SelectedNodeChanged event is raised, by default. Web developer can specify a different event by setting the SelectAction property for the property, by using one of the available options:

    -Expand-Toggles the node between expanded and collapsed. Raises the TreeNodeExpanded or TreeNodeCollapsed event, as appropriate.
    -None-Raises no events when a node is selected.
    -Select-Raises the SelectedNodeChanged event when a node is selected.
    -SelectExpand-Raises both the SelectedNodeChanged and TreeNodeExpanded events when a node is selected. Nodes are only expanded, never collapsed.

Note: The HoverNodeStyle is not rendered for a node with its SelectAction property set to TreeNodeSelectAction.None.

2.0, 3.0, 3.5, 4.0
SelectedNodeStyleThis property returns the TreeNodeStyle object that controls the appearance of the selected node in the TreeView control. Its default value is a null reference (Nothing in VB.NET).2.0, 3.0, 3.5, 4.0
SelectedValueReturns the returns the value of the Value property of the TreeNode object that is referred to by the SelectedNode property. If no node is currently selected in the TreeView control, an empty string (“”) is returned.2.0, 3.0, 3.5, 4.0
ShowCheckBoxesThis property gets or sets a value indicating which node types will display a check box in the TreeView control. To provide multi-node selection support in the TreeView control, Web developer can display check boxes next to the image for a node. He/she should use the ShowCheckBoxes property to determine which node types will display a check box, by setting one or bitwise combination of the following values: 

    -TreeNodeType.All-Check boxes are displayed for all nodes.
    -TreeNodeType.Leaf-Check boxes are displayed for all leaf nodes.
    -TreeNodeType.None-Check boxes are not displayed.
    -TreeNodeType.Parent-Check boxes are displayed for all parent nodes.
    -TreeNodeType.Root-Check boxes are displayed for all root nodes.

Note: Web developer can override the ShowCheckBoxes setting by setting the ShowCheckBox property for each node.

The value of this property is stored in view state.

2.0, 3.0, 3.5, 4.0
ShowExpandCollapseThis property is used to get or set a value indicating whether expansion node indicators are displayed. Its default value is true and the TreeView control displays a plus sign (+) or minus sign (-) or a placeholder image next to a node to indicate whether the node is expandable, collapsible, or non-expandable, respectively. Web developer can specify custom images by first setting the ImageSet property to TreeViewImageSet.Custom, and then setting the NoExpandImageUrl, ExpandImageUrl, and CollapseImageUrl properties to the URLs of the custom images. If no images are specified, the default images are used. The value of this property is stored in view state.2.0, 3.0, 3.5, 4.0
ShowLinesWeb developers use this property to get or set a value indicating whether lines connecting child nodes to parent nodes are displayed. Its default value is false and TreeView control does not display lines connecting nodes in this case. When this property is set to true, the TreeView control searches the Web-accessible folder that is specified by the LineImagesFolder property for the line images. 

Note: If the LineImagesFolder property is not set, the TreeView control will use the built-in, default images (20 x 20 pixels).

2.0, 3.0, 3.5, 4.0
SiteUsing this property software developer can get information about the container that hosts the current control when rendered on a design surface. A site binds a Component object to a Container object and enables communication between the two. It also provides a way for the container to manage its components.1.0,1.1, 2.0, 3.0, 3.5, 4.0
SkinIDThis property overrides Control.SkinID. 

Web developer can get or set the skin to apply to the control. Skins available to a control are contained in one or more skin files in a theme directory. The SkinID property specifies which of these skins to apply to the control. A skin is specific to a particular control i.e. software developer cannot share skin setting between controls of different types. If developer does not set the SkinID property, a control uses the default skin if one is defined.

2.0, 3.0, 3.5, 4.0
SkipLinkTextThis property is used to get or set a value that is used to render alternate text for screen readers to skip the content for the control. Property value is a string that the TreeView renders as alternate text with an invisible image as a hint to screen readers. Its default value is “Skip Navigation Links.”2.0, 3.0, 3.5, 4.0
StyleWeb developer can use this property to get a collection of text attributes that will be rendered as a style attribute on the outer tag of the Web server control. This property will render on all browsers for all controls.1.0,1.1, 2.0, 3.0, 3.5, 4.0
TabIndexWith this number software developer can control the tab order. The control with a TabIndex of zero has the focus when the page first loads. If end user presses Tab his/her focus will be moved to the control with the next lowest TabIndex. This property is available only in Internet Explorer 4.0 and higher.1.0,1.1, 2.0, 3.0, 3.5, 4.0
TagKeyWeb developers can use this property to get the HtmlTextWriterTag value that corresponds to this Web server control. This property is used primarily by control developers.1.0,1.1, 2.0, 3.0, 3.5, 4.0
TagNameWeb developers can use this property to get the name of the control tag. This property is used primarily by control developers.1.0,1.1, 2.0, 3.0, 3.5, 4.0
TargerThis property gets or sets the target window or frame in which to display the Web page content that is associated with a node. The default value is an empty string (“”), which refreshes the window or frame with focus. The Target value must begin with a letter in the range of A to Z (case-insensitive), except for the following special values, which begin with an underscore: 

    -_blank-A new window without frames
    -_parent-The immediate frameset parent.
    -_search-The search pane. Some browsers do not support this value.
    -_self-The frame with focus.
    -_top-The full window without frames.

The Target property renders as a target attribute. The target attribute on anchor elements is not allowed in the XHTML 1.1 document type definition. Web developers should not set the Target property if the rendered output for the ImageMap must be XHTML 1.1 compliant.

The value of this property is stored in view state.

2.0, 3.0, 3.5, 4.0
TemplateControlThis property is used to get or set a reference to the template that contains this control.2.0, 3.0, 3.5, 4.0
TemplateSourceDirectorySoftware developer can use this property to get the path to the page or user control that contains the current control. If the web page is installed in http://www.somesite.com/apps/application1 the property will return “apps/application1”.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ToolTipThis property displays a text message when the end users hover the mouse above the control.1.0,1.1, 2.0, 3.0, 3.5, 4.0
UniqueIDThis property can be used to get the unique, hierarchically qualified identifier for the server control. This property differs from the ID property, in that the UniqueID property includes the identifier for the server control’s naming container. This identifier is generated automatically when a page request is processed. This property is particularly important in differentiating server controls contained within a data-binding server control that repeats as Repeater, DataList, DetailsView, FormView, and GridView Web server controls.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ViewStateWeb developers can use this property to get a dictionary of state information that allows them to save and restore the view state of a server control across multiple requests for the same page.1.0,1.1, 2.0, 3.0, 3.5, 4.0
ViewStateIgnoresCaseThis property returns true if StateBag object is insensitive; otherwise, false. Its default value is false.1.0,1.1, 2.0, 3.0, 3.5, 4.0
VisibleWeb developers can use this property to get or set a value that indicates whether a server control is rendered as UI on the page. If the control is visible on the page this property will has value true; otherwise false.1.0,1.1, 2.0, 3.0, 3.5, 4.0
WidthThis property is used to specify the width of the Web server control. When software developer sets this property he/she should use combination of a numeric value followed by type of measurement: px (for pixels) or % (for percentage) and so on.This property does not render for all controls in browsers earlier than Microsoft Internet Explorer version 4. Controls that do not render this property in earlier browsers include Label, HyperLink, LinkButton, and any validation controls. The CheckBoxList, RadioButtonList and DataList also do not render this property in earlier browsers when their RepeatLayout property is set to RepeatLayout.Flow. Furthermore, only unit types of Pixel and Percentage are supported in earlier browsers.1.0,1.1, 2.0, 3.0, 3.5, 4.0