MVCxTab.SetTabTemplateContent(Action<TabControlTemplateContainer>) Method
Allows you to set a template for the current tab’s content.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
contentMethod | Action<TabControlTemplateContainer> | A method to which a template content rendering is delegated. |
Remarks
If the active tab template is not specified, the SetTabTemplateContent
method is raised twice: once for the inactive tab state, and once for the active state. This can cause the following exception: “An extension with X name already rendered” because a control in the template is rendered twice with the same name. You can resolve this issue in the following ways:
- Use the SetActiveTabTemplateContent method in addition to the
SetTabTemplateContent
method to specify a template for the active tab state. - Create a unique name based on the
Active
argument available in theSetTabTemplateContent
method.tabsettings.TabPages.Add(c => { c.Name = "Tab1"; c.Text = "First"; c.SetTabTemplateContent(headsettings => { string isActive = headsettings.Active ? "active" : string.Empty; Html.DevExpress().Image(imgsettings => { imgsettings.Name = "img1_" + isActive; imgsettings.Properties.EmptyImage.IconID = IconID.NavigationHome16x16office2013; imgsettings.ControlStyle.CssClass = "TabHeadImage"; }).Render(); } }
See Also