Skip to main content
Tab

NavBarGroup.Items Property

Gets the collection of items within the group and provides indexed access to them.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public NavBarItemCollection Items { get; }

Property Value

Type Description
NavBarItemCollection

A NavBarItemCollection object representing the collection of the group’s items.

Remarks

The Items property provides access to a collection that contains all the items of the current group. This collection provides standard means to manipulate (add or remove) items within a group. A particular item can be accessed using index notation.

If you need to obtain a collection that holds all the items of the navbar control, you can use the ASPxNavBar.Items property.

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