System.Web.UI.WebControls.TreeNodeBindingCollection Class

Represents a collection of System.Web.UI.WebControls.TreeNodeBinding objects in the System.Web.UI.WebControls.TreeView control. This class cannot be inherited.

See Also: TreeNodeBindingCollection Members

Syntax

public sealed class TreeNodeBindingCollection : System.Web.UI.StateManagedCollection

Remarks

The System.Web.UI.WebControls.TreeNodeBindingCollection class is used to store and manage a collection of System.Web.UI.WebControls.TreeNodeBinding objects in the System.Web.UI.WebControls.TreeView control. The System.Web.UI.WebControls.TreeView control uses the System.Web.UI.WebControls.TreeNodeBindingCollection class for its TreeView.DataBindings property.

The TreeView.DataBindings property contains System.Web.UI.WebControls.TreeNodeBinding objects that define the relationship between a data item and the node that 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), 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. You can bind a node to a specific data item property by specifying tree node bindings. Although the TreeView.DataBindings collection can be programmatically populated, it is usually set declaratively.

To set the tree node bindings declaratively:

[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]

You can programmatically manage a System.Web.UI.WebControls.TreeNodeBindingCollection by adding and removing System.Web.UI.WebControls.TreeNodeBinding objects. To add a System.Web.UI.WebControls.TreeNodeBinding object to the collection, use the TreeNodeBindingCollection.Add(TreeNodeBinding) or TreeNodeBindingCollection.Insert(int, TreeNodeBinding) method. To remove nodes from the collection, use the TreeNodeBindingCollection.Remove(TreeNodeBinding), TreeNodeBindingCollection.RemoveAt(int), or System.Web.UI.StateManagedCollection.Clear method.

The System.Web.UI.WebControls.TreeNodeBindingCollection class supports several ways to access the items in the collection:

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0