Free Trial Buy Now

Tree View - Data Binding

Description

This demo illustrates how the ASPxTreeView can be populated with node information taken from a data source.

Primarily designed to be a site navigation control, the ASPxTreeView supports binding to data sources containing hierarchical data. Any object that implements the IHierarchicalEnumerable or IHierarchicalDataSource interface (e.g. SiteMapDataSource, XmlDataSource, etc.) may be used as a data source for the ASPxTreeView control. The ASPxTreeView can be bound to a data source in a standard manner - using the DataSourceID or DataSource property.

The ASPxTreeView control implements specific properties that point to the data fields containing the necessary data. These are the TextField, ImageUrlField, NavigateUrlField, NameField and ToolTipField properties. If these properties are not defined, the ASPxTreeView is able to automatically bind to data fields whose names coincide with property names of a TreeViewNode object (such as the Text, Image.Url, NavigateUrl, Name and ToolTip).

The ASPxTreeView control implements the NodeDataBound event, allowing you to customize settings of an individual node after it has been bound to data. For instance, you can modify the content of a node or change its formatting.

The ASPxTreeView's DataBound event (which occurs after the control data binding has been finished) allows you to finally customize the control (for instance you can set the selected node).

In this demo, the ASPxTreeView is bound to an XML file using a standard XmlDataSource component. The source XML file contains hierarchical information about a set of classes and their members (properties, methods, events). The ASPxTreeView's TextField, ImageUrlField, and NavigateUrlField properties are used to specify the names of data item attributes from which the corresponding node settings should be obtained. The NodeDataBound event is handled to change the text style of nodes which represent classes (their text is displayed bold).

Version: v2012 vol 2.8
Experience the DevExpress Difference Today
Demos with source code are included with an installation of DevExpress controls for ASP.NET. Refer to the Demos and Sample Applications topic to learn more.
To download your free evaluation copy of our award-winning ASP.NET libraries, visit the Downloads page
All DevExpress ASP.NET Controls ship as part of DXperience ASP.NET, Enterprise, and Universal.
To obtain pricing information, visit the Pricing Options page or contact us via Email at info@devexpress.com
or by telephone at +1 (818) 844-3383 between 8:30am and 5pm Pacific Time.