System.Web 2.0.0.0 System.Object System.ICloneable System.Web.UI.IStateManager System.Web.UI.ParseChildren(true, "ChildNodes") The control is made up of nodes. Each entry in the tree is called a node and is represented by a object. A node that contains other nodes is called a parent node. A node that is contained by another node is called a child node. A node that has no child nodes is called a leaf node. A 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 has only one root node, the control allows you to add multiple root nodes to your tree structure. This is useful when you want to display item listings without displaying a single main root node, as in a list of product categories. A node primarily stores data in two properties, the property and the property. The value of the property is displayed in the control, and the property is used to store any additional data about the node, such as data used for handling postback events. A node also stores the path from the node to its root node in the property. The property indicates the node's position relative to the root node. Nodes at the same level must each have a unique value for the property; the control cannot distinguish between different nodes at the same level that have the same value. In this scenario, if the user clicks a node that has a duplicate value, the node that appears first in the control is selected. A object is made up of the following four user interface (UI) elements, which can be customized or hidden: An expansion node indicator icon used to show whether the node is expanded, collapsed, or non-expandable. An optional check box associated with the node. An optional node image. The node text. You can specify a custom image for the expandable, collapsible, and non-expandable node indicators by setting the , , and properties of the class. The expansion node indicator icons can even be hidden entirely by setting the property of the class to false. To display a check box next to a node, set the property of the class. When the property is set to a value other than TreeNodeType.Node, check boxes are displayed next to the specified node type. You can selectively override the check box of an individual node by setting the node's property. When a check box is displayed, use the property to determine whether the check box is selected. You can display an image in a node by setting the property. This image is displayed next to the node text. The text of a node in the control can be in one of two modes: selection mode or navigation mode. By default, a node is in selection mode. To put a node into navigation mode, set the node's property to a value other than an empty string (""). To put a node into selection mode, set the node's property to an empty string. Some Internet browsers have a limitation that can affect the performance of the control. For example, Microsoft Internet Explorer 6.0 has a URL character limit of 2067 characters that it posts. If the number of characters in a URL of a node is larger than that number, expanding that node will fail and no exception is thrown. By default, clicking a node that is in selection mode posts the page back to the server and raises the event. You can optionally specify a different event to raise by setting the node's SelectAction property. For more information, see . To determine which node was clicked in selection mode, use the property of the control. When a node is in navigation mode, all selection events are disabled for that node. Clicking the node in navigation mode directs the user to the specified URL. You can optionally set the property to specify the window or frame in which to display the linked content. The class contains several properties that are used to store the state of the node. Use the property to determine whether a node is selected. To determine whether the node is expanded, use the property. The property is used to determine whether a node is bound to data. When a node is bound to data, you can access the underlying data item by using the property. The class provides several properties that help to determine the position of a node relative to other nodes in the tree. Use the property to determine the depth of the node. You can get the delimited list of nodes from the current node to its root node by using the property. To determine the node's parent node, use the property. Child nodes are accessed using the collection. Sometimes, it is not practical to statically predefine the tree structure due to data size or custom content that depends on user input. Because of this, the control supports dynamic node population. A node can be populated at run time when it is expanded. Note that you can get unexpected behavior if you persist asynchronously created nodes. For example, if you use a background worker thread to populate nodes asynchronously, the node tree might not be populated immediately though the control proceeds with the rest of the page life cycle. On postback, the delayed creation of the nodes can cause problems when the control's view state is loaded but the node tree is not fully populated. For more information on dynamic node population, see the property. For a list of initial property values for an instance of , see the constructor. Represents a node in the control. Constructor Use this constructor to initialize a new instance of the class using the default values. When this constructor is used, all properties in the object are set to their default values. Be sure to set the properties, as necessary, after creating the object. Initializes a new instance of the class without text or a value. 2.0.0.0 Constructor Use this constructor to initialize a new instance of the class using the text specified by the parameter. The following table shows the initial property value for an instance of . Property Initial value The value of the parameter. Initializes a new instance of the class using the specified text. The text that is displayed in the control for the node. 2.0.0.0 Constructor Use this constructor to initialize a new instance of the class using the text and value specified by the and parameters, respectively. The following table shows initial property values for an instance of . Property Initial value The value of the parameter. The value of the parameter. Initializes a new instance of the class using the specified text and value. The text that is displayed in the control for the node. The supplemental data associated with the node, such as data used for handling postback events. 2.0.0.0 Constructor To be added. Initializes a new instance of the class using the specified owner. The that will contain the new . true if the is a root node; otherwise, false. 2.0.0.0 Constructor Use this constructor to initialize a new instance of the class using the text, value, and image URL specified by the , , and parameters, respectively. The following table shows initial property values for an instance of . Property Initial value The value of the parameter. The value of the parameter. The value of the parameter. Initializes a new instance of the class using the specified text, value, and image URL. The text that is displayed in the control for the node. The supplemental data associated with the node, such as data used for handling postback events. The URL to an image that is displayed next to the node. 2.0.0.0 Constructor Use this constructor to initialize a new instance of the class using the text, value, image and navigation URLs, and display target specified by the , , , , and parameters, respectively. The following table shows initial property values for an instance of . Property Initial value The value of the parameter. The value of the parameter. The value of the parameter. The value of the parameter. The value of the parameter. Initializes a new instance of the class using the specified text, value, image URL, navigation URL, and target. The text that is displayed in the control for the node. The supplemental data associated with the node, such as data used for handling postback events. The URL to an image that is displayed next to the node. The URL to link to when the node is clicked. The target window or frame in which to display the Web page content linked to when the node is clicked. 2.0.0.0 Property System.ComponentModel.DefaultValue(false) System.Boolean To be added. When a node displays a check box, the property is commonly used to specify whether the check box is selected. When the check box associated with a node is selected, the node is automatically added to the collection of the control. The property can also be used to determine whether the check box is selected. It is more common to determine which nodes in the control have their check boxes selected by iterating through the collection. The value of this property is stored in view state. Gets or sets a value that indicates whether the node's check box is selected. 2.0.0.0 Property System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerDefaultProperty) System.ComponentModel.Browsable(false) System.ComponentModel.MergableProperty(false) System.ComponentModel.DefaultValue(null) System.Web.UI.WebControls.TreeNodeCollection To be added. Use the property to get a collection that contains the first-level child nodes of the current node. This collection is commonly used to iterate through all the first-level child nodes, or to access a specific first-level child node of the current node. The property can also be used to programmatically manage the first-level child nodes in the current node. You can add, insert, remove, and retrieve objects from the collection. Any updates to the collection will automatically be reflected in the control the next time the page is refreshed. To access child nodes further down the tree, use the property of the next-level child node to navigate down the node levels. Gets a collection that contains the first-level child nodes of the current node. 2.0.0.0 Method System.Object This is a helper method that supports the interface implemented by . Creates a new instance of the class with the properties of the current instance. A new instance of with the properties of the current instance. 2.0.0.0 Method System.Void Use the method to conveniently collapse the current node. As an alternative, you can also set the property to false. To collapse the current node and all its child nodes, consider using the method. will collapse all the nodes in the entire tree. Collapses the current tree node. 2.0.0.0 Method System.Void Use the method to conveniently collapse the current node and all its child nodes. As an alternative, you can also set the property of the current node and each of its child nodes to false. To collapse only the current node, consider using the method. will collapse all the nodes in the entire tree. Collapses the current node and all its child nodes. 2.0.0.0 Property System.ComponentModel.Browsable(false) System.ComponentModel.DefaultValue(false) System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.Boolean To be added. The property is used to programmatically determine whether the node was created through data binding. Because dynamic and static content cannot be mixed in the same node, this property is commonly used when populating a control dynamically to determine whether the node contains static content. The value of this property is stored in view state. Gets a value that indicates whether the node was created through data binding. 2.0.0.0 Property System.ComponentModel.Browsable(false) System.ComponentModel.DefaultValue(null) System.Object To be added. When the control is bound to a data source, such as an object, this property is set to the data item that is bound to this specific node. This property is commonly used to access the values of the data item. This property is available only after data binding has occurred. Gets the data item that is bound to the control. 2.0.0.0 Property System.ComponentModel.Browsable(false) System.ComponentModel.DefaultValue("") System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.String To be added. The property value is commonly used when calling the method to provide the path to the data bound to the current node. This method then returns a object that contains the data at the specified path. The value of this property is stored in view state. Gets the path to the data bound to the node. 2.0.0.0 Property System.ComponentModel.Browsable(false) System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.Int32 To be added. Use the property to determine the depth of the node. The depth represents the number of levels of hierarchy between a node and the root node. For example, a root node has a depth of zero. A child of the root node has a depth of one, and so on. Gets the depth of the node. 2.0.0.0 Method System.Void Use the method to conveniently expand the current node. As an alternative, you can also set the property to true. To expand the current node and all its child nodes, consider using the method. will expand all the nodes in the entire tree. The value of this property is stored in view state. Expands the current tree node. 2.0.0.0 Method System.Void Use the method to conveniently expand the current node and all its child nodes. As an alternative, you can also set the property of the current node and each of its child nodes to true. To expand only the current node, consider using the method. will expand all the nodes in the entire tree. Expands the current node and all its child nodes. 2.0.0.0 Property System.ComponentModel.DefaultValue(null) System.Nullable<System.Boolean> To be added. Use the property to specify or determine whether the node is expanded. You can expand and collapse a node by calling the and methods, respectively. You can also expand and collapse a node and all its child nodes by calling the and methods, respectively. Since the property is a tri-state property, the following C# code snippet causes a compile error: protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { if (TreeView1.Nodes[0].Expanded) { // some work here } } While VB.Net implicitly casts the Boolean value to a NullableBoolean, C# does not. Therefore, it is a best practice to explicitly check the state of the property. For example, the following code examples in Visual Basic and C# explicitly test the value of the property. The following Visual Basic code example explicitly tests the value of the property. This example tests if the property is set to True; therefore Nothing and False fall through the If statement. If TreeView1.Nodes(0).Expanded = True Then 'some work hereEnd IF This C# code example explicitly tests the value of the property. This example tests if the property is set to True; therefore Null and False fall through the If statement. if( TreeView1.Nodes[0].Expanded == true ) { //some work here} Gets or sets a value that indicates whether the node is expanded. 2.0.0.0 Property System.ComponentModel.DefaultValue("") System.ComponentModel.Localizable(true) System.String To be added. When an image is displayed next to a node (when the property is set), use the property to specify the ToolTip displayed when the user positions the mouse pointer over the image. The text that you specify provides assistive technology devices with a description of the image that can be used to make the control more accessible. The value of this property is stored in view state. The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization. Gets or sets the ToolTip text for the image displayed next to a node. 2.0.0.0 Property System.ComponentModel.Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor)) System.Web.UI.UrlProperty System.ComponentModel.DefaultValue("") System.String To be added. Use the property to specify a custom image for the current node in the control. This image is displayed next to the node and can be in any file format (.jpg, .gif, .bmp, and so on), as long as the client's browser supports that format. The value of this property is stored in view state. Gets or sets the URL to an image that is displayed next to the node. 2.0.0.0 Property System.Boolean To be added. To be added. Gets a value that indicates whether the node is saving changes to its view state. 2.0.0.0 Method System.Void To be added. is a helper method used to load the previously saved view state of the node Loads the previously saved view state of the node. 2.0.0.0 Property System.ComponentModel.Editor("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor)) System.Web.UI.UrlProperty System.ComponentModel.DefaultValue("") System.String To be added. The text of a node can be in one of two modes: selection mode or navigation mode. By default, a node is in selection mode. To put a node into navigation mode, set the node's property to a value other than an empty string. When a node is in navigation mode, all selection events are disabled for that node. Clicking the node in navigation mode links the user to the specified URL. You can optionally set the property to specify the window or frame in which to display the linked content. The value of this property is stored in view state. Gets or sets the URL to navigate to when the node is clicked. 2.0.0.0 Property System.ComponentModel.Browsable(false) System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.Web.UI.WebControls.TreeNode To be added. The property returns a object that represents the parent node of the current node. It is commonly used to determine the parent node or to access the properties of the parent node. A root node does not have a parent node. To access the child nodes of the current node, use the property. Gets the parent node of the current node. 2.0.0.0 Property System.ComponentModel.DefaultValue(false) System.Boolean To be added. Sometimes, it is not practical to statically predefine the tree structure due to data size or custom content that depends on user input. Because of this, the control supports dynamic node population. When a node's property is set to true, that node is populated at run time through a postback event when the node is expanded. To populate a node dynamically, an event-handling method that populates the node must be defined for the event. Supported browsers can also take advantage of client-side node population. When enabled, this allows the control to dynamically populate a node on the client when that node is expanded, which prevents the need to post back to the server. For more information on client-side node population, see . The value of this property is stored in view state. Gets or sets a value that indicates whether the node is populated dynamically. 2.0.0.0 Method System.Void This method can be overridden by control developers to add additional rendering after the node is rendered. Allows control developers to add additional rendering to the node. The that represents the output stream used to write content to a Web page. 2.0.0.0 Method System.Void This method can be overridden by control developers to add additional rendering before the node is rendered. Allows control developers to add additional rendering to the node. The that represents the output stream used to write content to a Web page. 2.0.0.0 Method System.Object The method is a helper method called by the node to save its state. Saves the current view state of the node. An that contains the saved state of the node. 2.0.0.0 Method System.Void Use the method to select the current node in the control. Note   As an alternative, you can also select the current node by setting the property to true. Selects the current node in the control. 2.0.0.0 Property System.ComponentModel.DefaultValue(System.Web.UI.WebControls.TreeNodeSelectAction.Select) System.Web.UI.WebControls.TreeNodeSelectAction To be added. The text of a node in the control can be in one of two modes: selection mode or navigation mode. By default, a node is in selection mode. To put a node into navigation mode, set the node's property to a value other than an empty string (""). To put a node into selection mode, set the node's property to an empty string. When a node is in navigation mode, selection events are disabled for that node. Clicking a node will direct the user to the specified URL, rather than posting the page back to the server and raising an event. When a node is in selection mode, use the property to specify which event or events are raised when a node is selected. The following table lists the available options. Selection action Description TreeNodeSelectAction.Expand Toggles the node between expanded and collapsed. Raises the event or the event as appropriate. TreeNodeSelectAction.None Raises no events when a node is selected. TreeNodeSelectAction.Select Raises the event when a node is selected. TreeNodeSelectAction.SelectExpand Raises both the and the events when a node is selected. Nodes are only expanded, never collapsed. The property is not rendered for a node with its property set to TreeNodeSelectAction.None. The value of this property is stored in view state. Gets or sets the event or events to raise when a node is selected. 2.0.0.0 Property System.ComponentModel.DefaultValue(false) System.Boolean To be added. Use the property to specify or determine whether the node is selected. Although the property can be used to determine whether the node is selected, it is more common to use the property. Only one node can be selected at a time in the control when using this property. As an alternative, you can also select the node by using the method. The value of this property is stored in view state. Gets or sets a value that indicates whether the node is selected. 2.0.0.0 Property System.ComponentModel.DefaultValue(null) System.Nullable<System.Boolean> To be added. The control allows you to display a check box next to a node's image. Use the property to show or hide the check box for the current node. Although the property can be used to display check boxes, it is more common to use the property of the control. The property, however, affects every node type specified by the property; therefore, the property is often used to override that setting for an individual node. Since the property is a tri-state property, the following C# code snippet causes a compile error: protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { if (TreeView1.Nodes[0].Expanded) { // some work here } } While VB.Net implicitly casts the Boolean value to a NullableBoolean, C# does not. Therefore, it is a best practice to explicitly check the state of the property. For example, the following code examples in Visual Basic and C# explicitly test the value of the property. The following Visual Basic code example explicitly tests the value of the property. This example tests if the property is set to True; therefore Nothing and False fall through the If statement. If TreeView1.Nodes(0).Expanded = True Then 'some work hereEnd IF This C# code example explicitly tests the value of the property. This example tests if the property is set to True; therefore Null and False fall through the If statement. if( TreeView1.Nodes[0].Expanded == true ) { //some work here} The value of this property is stored in view state. Gets or sets a value that indicates whether a check box is displayed next to the node. 2.0.0.0 Method 2.0.0.0 System.Object The method is used by the class to make a copy of itself. Creates a copy of the object. An that represents a copy of the object. Property 2.0.0.0 System.Boolean To be added. This member is an explicit interface member implementation. It can be used only when the instance is cast to the interface. For a description of this member, see . Method 2.0.0.0 System.Void To be added. To be added. Loads the node's previously saved view state. Method 2.0.0.0 System.Object To be added. Saves the view state changes to a . The that contains the view state changes. Method 2.0.0.0 System.Void After this method has been called on a server control, the property returns true. Instructs the object to track changes to its view state. Property System.ComponentModel.DefaultValue("") System.String To be added. Use the property to specify the window or frame in which to display the Web content linked to a node when that node is clicked. Setting this property overrides the property of the control. The property renders as a target attribute. The target attribute on anchor elements is not allowed in the XHTML 1.1 document type definition. Do not set the property if the rendered output for the object must be XHTML 1.1-compliant. For more information, see ASP.NET and XHTML Compliance. When creating accessible Web pages, it is strongly recommended you avoid using the property to target another window. For more information, see ASP.NET Accessibility. The value of this property is stored in view state. Gets or sets the target window or frame in which to display the Web page content associated with a node. 2.0.0.0 Property System.ComponentModel.DefaultValue("") System.ComponentModel.Localizable(true) System.String To be added. Use the property to specify or determine the text that is displayed for the node in the control. If the property contains null, the get accessor returns the value of the property. If the property, in turn, contains null, is returned. The value of this property is stored in view state. The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization. Gets or sets the text displayed for the node in the control. 2.0.0.0 Method System.Void Use the method to alternate between an expanded and a collapsed state for the node. For example, if the node is collapsed, calling the method expands the node, and vice versa. As an alternative, you can set the property directly. Alternates between the expanded and collapsed state of the node. 2.0.0.0 Property System.ComponentModel.DefaultValue("") System.ComponentModel.Localizable(true) System.String To be added. Use the property to specify the ToolTip text for the node. The ToolTip text is displayed when the mouse pointer is positioned over the node. The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization. Gets or sets the ToolTip text for the node. 2.0.0.0 Method System.Void To be added. Marks the starting point at which to begin tracking and saving view state changes to the node. 2.0.0.0 Property System.ComponentModel.DefaultValue("") System.ComponentModel.Localizable(true) System.String To be added. The property is used to supplement the property by storing any additional data associated with the node. This value is not displayed in the control and is commonly used to store data for handling postback events. If the property contains null, the get accessor returns the value of the property. If the property, in turn, contains null, is returned. Nodes at the same level must each have a unique value for the property; the control cannot distinguish between different nodes at the same level that have the same value. In this scenario, if the user clicks a node that has a duplicate value, the node that appears first in the control is selected. The value of this property is stored in view state. The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization. Gets or sets a non-displayed value used to store any additional data about the node, such as data used for handling postback events. 2.0.0.0 Property System.ComponentModel.Browsable(false) System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.String To be added. The property contains a delimiter-separated list of node values that form a path from the root node to the current node. Use the property to specify the delimiter character used to separate the node values. This value is commonly used when parsing the list for the individual values, or to pass as an argument to the method of the class. Depending on the value displayed in the control, the delimiter character might need to be changed to prevent any conflicts. For example, if you set the delimiter character to a comma, the displayed value should not contain any commas; otherwise, you cannot accurately parse the property. Nodes at the same level must each have a unique value for the property; the control cannot distinguish between different nodes at the same level that have the same value. In this scenario, if the user clicks a node that has a duplicate value, the node that appears first in the control is selected. Gets the path from the root node to the current node. 2.0.0.0