NavBarItem.Template Property
Gets or sets a template used to display the content of the item.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
#Property Value
Type | Default | Description |
---|---|---|
ITemplate | null | An object supporting the System. |
#Remarks
Use the Template property to control the contents of the current item. The template defined using this property replaces the content of an item - in particular, the specified image and text of an item.
Note that any style settings defined for the item via the specific properties (such as the ASPxNavBar.ItemStyle or NavBarGroup.ItemStyle) are still in effect for the item whose content is specified through using the Template property.
In order to define the common content for all items within a navbar control, the navbar’s ASPxNavBar.ItemTemplate property can be used. A template for items of a particular group can be specified via the NavBarGroup.ItemTemplate property.
Note
Once a template defined via the Template property is created within a tab control, it is instantiated within a container object of the Nav
#Example
This example demonstrates how the ASPxNavBar.GroupDataBound and the ASPxNavBar.ItemDataBound events can be used.
protected void ASPxNavBar1_GroupDataBound(object source, DevExpress.Web.NavBarGroupEventArgs e) {
NavBarItem btnItem = e.Group.Items.Add();
btnItem.Template = LoadControl("ContentTemplate.ascx") as ITemplate;
}
protected void ASPxNavBar1_ItemDataBound(object source, NavBarItemEventArgs e) {
if (e.Item.Text == "Canon EOS 400D") {
e.Item.Text = e.Item.Text + " (New model)";
}
}