System.Web.UI.WebControls Namespace TreeView Class
.NET Framework version 2.0
Sets or retrieves a value specifying whether a TreeView control automatically generates tree node bindings.
Inline |
<asp:treeview autogeneratedatabindings = true | false ... > |
Script |
TreeView.AutoGenerateDataBindings [ = true | false ] |
This property accepts or returns only a boolean value: true to have the TreeView control automatically generate tree node bindings; otherwise, false. Default value is true.
Use the AutoGenerateDataBindings property to have the TreeView control automatically generate 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.
If the AutoGenerateDataBindings property is set to true, the TreeView 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.
NOTE: The automatically generated tree node bindings are not added to the DataBindings collection.
In the case of an XML element, the value that is returned by the ToString method is the element name, which shows the underlying structure of the XML file, but is not very useful otherwise. To create a more useful tree, you must define your own tree node bindings by populating the DataBindings collection.
NOTE: If you define a DataBindings collection, the TreeView control uses those values instead of automatically generated tree node bindings.
TreeView Members DataBindings