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

NavBarGroup.Items Property

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll

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);
     }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Items 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