Data Binding Using Mapping Properties
When ASPxNavBar binds to an arbitrary data source (specified by the ASPxHierarchicalDataWebControl.DataSourceID or ASPxDataWebControlBase.DataSource property), NavBarGroup and NavBarItem objects are created automatically for every recognized first and second level data item respectively. Individual group and item characteristics (such as text, name, image path, navigation location, and tooltip text) are obtained from the data fields (item attributes) of corresponding data items. ASPxNavBar exposes its specific data-related properties, allowing you to specify which data source fields the group/item information should be retrieved from. The tables below list these properties and the corresponding properties of NavBarGroup and NavBarItem objects.
Groups data-related properties
ASPxNavBar data-related properties | Corresponding group object properties |
---|---|
NavBarGroupDataFields.HeaderImageUrlField | NavBarGroup.HeaderImage.Url |
NavBarGroupDataFields.NameField | NavBarGroup.Name |
NavBarGroupDataFields.NavigateUrlField | NavBarGroup.NavigateUrl |
NavBarGroupDataFields.TextField | NavBarGroup.Text |
NavBarGroupDataFields.ToolTipField | NavBarGroup.ToolTip |
Items data-related properties
ASPxNavBar data-related properties | Corresponding item object properties |
---|---|
NavBarItemDataFields.ImageUrlField | NavBarItem.Image.Url |
NavBarItemDataFields.NameField | NavBarItem.Name |
NavBarItemDataFields.NavigateUrlField | NavBarItem.NavigateUrl |
NavBarItemDataFields.TextField | NavBarItem.Text |
NavBarItemDataFields.ToolTipField | NavBarItem.ToolTip |
The picture below demonstrates the data retrieval path during the binding to an XML file.