Binding to Data Overview
ASPxNavBar can be populated with item and group information taken from a data source, which can be any object that implements the IHierarchicalEnumerable or IHierarchicalDataSource interface (e.g. SiteMapDataSource, XmlDataSource, etc.).
A data source can be specified by using either of the following ASPxNavBar properties:
- ASPxDataWebControlBase.DataSource to programmatically supply a data object;
- ASPxHierarchicalDataWebControl.DataSourceID to define a declarative data source.
The image below demonstrates the path for binding ASPxNavBar to an XML file.
ASPxNavBar supports two methods of retrieving data from a 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 ASPxNavBar's ability to retrieve data automatically, given that the data source item attributes are named after the property names of a NavBarItem or NavBarGroup object.
Whichever way you choose, the ASPxNavBar control automatically creates the NavBarItem and NavBarGroup objects and retrieves their property values from corresponding items.
Additionally, ASPxNavBar provides you with specific events related to data binding that you can handle according to your application logic (for example, modify item content style).