Skip to main content
A newer version of this page is available. .
Tab

ASPxNavBar.Groups Property

Gets the collection of groups in NavBar.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public NavBarGroupCollection Groups { get; }

Property Value

Type Description
NavBarGroupCollection

A NavBarGroupCollection object which represents the collection of groups within the navbar.

Remarks

The Groups property is used to provide access to the collection of groups within the navbar control. The collection is represented by an instance of the NavBarGroupCollection class and allows individual groups (which are instances of the NavBarGroup class) to be added, deleted and accessed using an indexer notation.

Example

This example demonstrates how to modify the ASPxNavBar‘s group header content.

using DevExpress.Web.ASPxNavBar;
...
protected void Page_Load(object sender, EventArgs e) {
     NavBarGroup group1 = new NavBarGroup("group1", "group1");
     NavBarItem item1 = new NavBarItem("item1", "item1");

     ASPxNavBar1.Groups.Add(group1);
     group1.Items.Add(item1);

     group1.HeaderTemplate = new MyTemplate();
     group1.HeaderTemplateCollapsed = new MyTemplate1();

}

public class MyTemplate : ITemplate {
     void ITemplate.InstantiateIn(Control container) {
          Label label = new Label();
          label.Text = "The group is expanded";
          container.Controls.Add(label);
     }
}

public class MyTemplate1 : ITemplate {
     void ITemplate.InstantiateIn(Control container) {
          Label label2 = new Label();
          label2.Text = "The group is collapsed";
          container.Controls.Add(label2);
     }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Groups property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also