Tab
A newer version of this page is available. Switch to the current version.

ASPxNavBar Class

Represents the web navigation bar control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

public class ASPxNavBar :
    ASPxHierarchicalDataWebControl,
    IRequiresLoadPostDataControl,
    IControlDesigner
Public Class ASPxNavBar
    Inherits ASPxHierarchicalDataWebControl
    Implements IRequiresLoadPostDataControl,
               IControlDesigner

Related API Members

The following members accept/return ASPxNavBar objects:

Library Related API Members
ASP.NET Controls and MVC Extensions NavBarDataFields.NavBar
NavBarGroup.NavBar
NavBarItem.NavBar
ASP.NET Bootstrap Controls BootstrapAccordionGroup.NavBar
BootstrapAccordionGroupDataFields.NavBar
BootstrapAccordionItem.NavBar
BootstrapAccordionItemDataFields.NavBar
eXpressApp Framework RenderHelper.CreateASPxNavBar()

Remarks

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.

NOTE

The ASPxNavBar control provides you with comprehensive client-side functionality implemented using JavaScript code (see DevExpress.Web.Scripts to learn more):

The control's client-side API is enabled if the ASPxNavBar.EnableClientSideAPI property is set to true, or the ASPxNavBar.ClientInstanceName property is defined, or any client event is handled.

Use the navbar's ASPxNavBar.AutoPostBack property to control whether any end-user manipulation with the navbar's elements requires posting back to the server side for further processing. If the necessity of such posting is not cancelled in a handler of the corresponding client-side event, round trips to the server can be performed either using standard postbacks (the whole page is refreshed) or the newly implemented AJAX-based callback technology. The ASPxNavBar.EnableCallBacks property of the navbar control can be used to specify which technology to use when posting back to the server.

See Also