Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Data Binding

v
XPath: /Cameras/*

This demo illustrates how you can bind the ASPxNavBar to a data source. The ASPxNavBar control supports standard data binding. In this instance any object which implements the IHierarchicalEnumerable or IHierarchicalDataSource interface (e.g. SiteMapDataSource, XmlDataSource) may be used as a data source for this control.

In this demo, the navbar control is bound to a standard data source of the type XmlDataSource. This data source supplies the navbar with data from a specific Cameras.xml file. The ASPxNavBar requires data to be represented as different navbar items combined into groups. Use the data source's XPath property to obtain the desired sample of data. (See ASPX code)

Note that the text within each navbar item is composed by using the navbar's template of the type ItemTextTemplate.

Our web controls provide you the ability to bind the properties of the controls that compose a template directly to the properties of the corresponding data object (DataItem) from the bound data source. For this purpose, the Container.Item.DataItem property or the Container.EvalDataItem(<expression>) method can be used. Refer to ASPX code to see how the properties of child controls which populate the navbar's template of the ItemTextTemplate type are bound directly to the specific data of the XmlDataSource's node by using the Container.EvalDataItem(<expression>) method.

Collapse/Expand
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
Open VB Solution
The source code files for this demo are installed (by default) in the following directories:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\ASPxNavigationAndLayoutDemos
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\VB\ASPxNavigationAndLayoutDemos