Free Trial Buy Now

Menu - Data Binding

Group A>
Group B>
Group C>
Group D>
Group E>
Group F>
Group G>
Group H>

Description

This demo illustrates how you can bind the ASPxMenu control to a data source. The ASPxMenu control supports the standard way of 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 menu control is bound to a ASPxSiteMapDataSource type data source. The ASPxSiteMapDataSource allows you to load site map data at runtime from a specific file by using the LoadFromFile method. This method is passed with a parameter which specifies the path to the .sitemap file which contains the required data. Note that at design-time, the ASPxSiteMapDataSource component contains a predefined site map tree structure. Although the site map data source is not connected to any site map provider (its SiteMapProvider property is not set explicitly), a call to the LoadFromFile method when the page loads, automatically creates an internal instance of our specific UnboundSiteMapProvider provider which supplies the site map data source component with new data from the specified file. Refer to VB or C# code to see how the LoadFromFile method is called on the page's load.

Note that the menu's ItemDataBound event can be used to manipulate the values being assigned to the properties of a menu item during its data binding. Look at the ItemDataBound event's implemetation (see VB or C# code) that demonstrates how to assign a specific value to a menu item's Text property by combining the text to be assigned to this property with the value of the specific result attribute of the corresponding site map node which the item is being bound to.

Version: v2011 vol 2.11
Experience the DevExpress Difference Today
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.