This demo illustrates how the BindToSiteMap method can be used to easily populate the Menu for ASP.NET MVC with item information taken from a SiteMap file.
Note that the Menu for ASP.NET MVC is able to automatically retrieve item information by binding to data fields whose names coincide with property names of an item object (such as the Text, NavigateUrl, Image and ToolTip). In this demo, the image path of items is obtained automatically from the corresponding attributes of data source nodes. The texts and navigation locations of items are retrieved from the standard attributes of a SiteMap file - the 'url' and 'title'. The texts of items of the last nested level are composed dynamically, by concatenating the values of the 'result' and 'title' attributes. This processing is performed within a method delegate specified by the ItemDataBound property, which allows you to manipulate the values being assigned to the properties of a menu item during its data binding.
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).
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxNavigationAndLayoutDemos |