Skip to main content

NavBarGroup.HeaderTemplate Property

Gets or sets a template used for displaying the content of the group’s header.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web


public virtual ITemplate HeaderTemplate { get; set; }

Property Value

Type Default Description
ITemplate null

An object supporting the System.Web.UI.ITemplate interface which contains the template used for displaying the content of the group’s header.


Use the HeaderTemplate property to control the contents of the current group’s header. The template defined using this property replaces the content of the group header - in particular, the image and text associated with the header.

Note that any style settings defined for the header via the specific properties (such as the ASPxNavBar.GroupHeaderStyle or NavBarGroup.HeaderStyle) are still in effect for the group’s header whose content is specified through using the HeaderTemplate property.

In order to define a common content for all group headers within a navbar control, the navbar’s ASPxNavBar.GroupHeaderTemplate property can be used.


Once a template defined via the HeaderTemplate property is created within a control, it is instantiated within a container object of the NavBarGroupTemplateContainer type. This container object exposes a set of specific properties to which the template’s child controls can be bound.



If you defined the HeaderTemplate template content and had not defined the HeaderTemplateCollapsed template, the HeaderTemplateCollapsed template content will be automatically generated. All the controls within the HeaderTemplate content will be automatically added to the HeaderTemplateCollapsed template content (with the new Control.ID property value). It is recommended that you define the template content for both HeaderTemplate and HeaderTemplateCollapsed.


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


     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";

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