Skip to main content

Bind to Data

  • 2 minutes to read

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.

A data source can be specified by using either of following properties of the ASPxTreeView control:

The image below demonstrates the path for binding an ASPxTreeView to an XML file.

TreeView - Binding To Xml

The ASPxTreeView supports two methods to retrieve data from the specified data source. One involves manually setting the control’s specific data-related properties to the data source item attribute names. The other one exploits the ASPxTreeView’s ability to retrieve data automatically, given that the data source item attributes are named after the property names of an ASPxTreeView object.

Whichever way you choose, the ASPxTreeView control automatically creates the TreeViewNode objects and retrieves their property values from the corresponding items.

Additionally, the ASPxTreeView provides you with specific events related to data binding that you can handle according to your application logic (for example, modify node content style).

Concepts