Skip to main content
Tab

ASPxNavBar.Groups Property

Gets the collection of groups in NavBar.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.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);
     }
}
See Also