Represents the web navigation bar control.
Related API Members
The following members accept/return ASPxNavBar objects:
|Library||Related API Members|
|ASP.NET Controls and MVC Extensions||NavBarDataFields.NavBar|
|ASP.NET Bootstrap Controls||BootstrapAccordionGroup.NavBar|
Add an ASPxNavBar control to your web application to provide it with the advanced navigation capabilities. This control allows you to display a number of Items arranged into different groups. The ASPxNavBar control supports the following common features:
- Data binding that allows the control’s groups and items to be bound to hierarchal data sources.
- Programmatic access to the navbar object model to dynamically create groups, populate them with items, set properties, and so on.
- Programmatic access to the navbar client-side object model to perform specific client actions with groups and items.
- An ability to perform round-trips to the server using the AJAX-based callback technology.
- Customizable appearance through themes, user-defined images, styles, and user-defined templates.
Groups of the navbar control can be accessed by the ASPxNavBar.Groups property. Each group has its collection of items available using the NavBarGroup.Items property. The ASPxNavBar control also maintains a specific ASPxNavBar.Items collection which contains all the items from all the groups. This collection allows you to easily iterate through all navbar items or access an individual item by specifying its name or display text.
Groups of items can be expanded/collapsed either using the user interface or programmatically (see the NavBarGroup.Expanded property and the NavBarGroupCollection.ExpandAll method) in order to show/hide their contents. The visibility and the visual order of items within their groups and groups within the navbar control can be controlled by the NavBarItem.Visible and NavBarItem.VisibleIndex properties of items and the NavBarGroup.Visible and NavBarGroup.VisibleIndex properties of groups.
You can make the items or headers of groups act like hyperlinks or implement the desired custom behavior. Custom behavior of items or group headers can be implemented by handling their click events (such as the ASPxNavBar.ItemClick and ASPxNavBar.HeaderClick). To make an item or a group header serve as a link, use the item’s NavBarItem.NavigateUrl or the group’s NavBarGroup.NavigateUrl property respectively to specify the linked page. By default, a linked page is displayed in the same window or frame as the navbar control. To display the linked content in a different window or frame, use the navbar’s ASPxNavBar.Target property. The appearance style of all links within the navbar control can be defined via the ASPxNavBar.LinkStyle property. In order to control the clickable area of items, the ASPxNavBar.ItemLinkMode property can be used.
The ASPxNavBar control offers you complete customization of groups, group headers and item styles (for instance, see the ASPxNavBar.GroupContentStyle, ASPxNavBar.GroupHeaderStyle and ASPxNavBar.ItemStyle properties). Moreover, you can use the template technology to get unlimited control over the contents of items, group headers and group client regions. You can specify the corresponding templates at the level of the navbar control (see the ASPxNavBar.ItemTemplate, ASPxNavBar.GroupHeaderTemplate and ASPxNavBar.GroupContentTemplate properties), at the level of individual groups (see the NavBarGroup.ItemTemplate, NavBarGroup.HeaderTemplate and NavBarGroup.ContentTemplate) and at the level of individual items (see the NavBarItem.Template property).
A navbar control can be bound to any hierarchical data source by using its ASPxHierarchicalDataWebControl.DataSourceID or ASPxDataWebControlBase.DataSource property. Note that during data binding specific ASPxNavBar.ItemDataBound and ASPxNavBar.GroupDataBound events are generated which, for instance, allow you to dynamically map properties of the navbar’s items and groups to the required data fields from the bound data source, if needed.