This example demonstrates available ways to manipulate the DevExpress MVC Navigation Bar programmatically on the client using our extended client-side functionality. The client object of the NavBar can be accessed on the client-side by its Name.
In this demo, each NavBar group or item is identified using its Name property. In order to obtain a specific group or item by its name on the client, the GetGroupByName or GetItemByName method is used respectively. In this demo, the NavBar's AutoCollapse mode is enabled, specifying that only one group can be expanded within the NavBar at any one time. In this mode, a group's SetExpanded method can be used to expand the desired group.
A given NavBar item can be selected within each group via the SetSelectedItem method by passing it the required item.
The GroupExpandedChanged function that is a handler of the NavBar's ExpandedChanged event demonstrates how to synchronize values of the dropdown editors with the expanded group and the group's selected item, if any.
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).
The source code files for this demo are installed (by default) in the following directory:
Open CS Solution
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxNavigationAndLayoutDemos