System.Web.UI.WebControls.TreeNodeBinding.DataMember Property

Gets or sets the value to match against a System.Web.UI.IHierarchyData.Type property for a data item to determine whether to apply the tree node binding.

Syntax

[System.ComponentModel.DefaultValue("")]
public string DataMember { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

A data member specifies the type of the data item in the underlying data source, but can represent different information depending on the data source. Each data item in a hierarchical data source (represented by a System.Web.UI.IHierarchyData object) exposes a System.Web.UI.IHierarchyData.Type property, which specifies the type of the data item. For example, the data member for an XML element specifies the name of the element. When a data source contains multiple data item types, the data member specifies which data item type to use. The following System.Web.UI.WebControls.TreeNodeBinding declaration binds the <Book> elements of an System.Web.UI.WebControls.XmlDataSource control to all the nodes in the tree, regardless of the location in the hierarchy:

Example

<asp:TreeNodeBinding DataMember="Book" TextField="Title" ValueField= "ISBN">

When creating a System.Web.UI.WebControls.TreeNodeBinding object, you must specify the criteria for binding. The criteria indicates when a data item should be bound to a node. You can specify the TreeNodeBinding.Depth or TreeNodeBinding.DataMember property, or both properties. There is a slight performance gain by specifying both.

Once the binding criteria is established, you can then bind a property of a System.Web.UI.WebControls.TreeNode object that can be bound to a value. You can bind to a field of a data item or to a static value. When bound to a static value, all System.Web.UI.WebControls.TreeNode objects to which the System.Web.UI.WebControls.TreeNodeBinding object is applied share the same value.

The value of this property is stored in view state.

Requirements

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