Skip to main content

MVCxGridViewColumnLayoutItem.SetTemplateContent(Action<GridViewEditFormLayoutItemTemplateContainer>) Method

Allows you to provide a template for rendering the column layout item content.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public void SetTemplateContent(
    Action<GridViewEditFormLayoutItemTemplateContainer> contentMethod
)

Parameters

Name Type Description
contentMethod Action<GridViewEditFormLayoutItemTemplateContainer>

A method to which a template content rendering is delegated.

Remarks

When you call the SetTemplateContent method, a SetEditItemTemplateContent(Action<GridViewEditItemTemplateContainer>) method call has no effect.

settings.EditFormLayoutProperties.Items.Add(item=> {
    item.ColumnSpan = 2;
    item.ColumnName = "UnitPrice";
    item.RequiredMarkDisplayMode = FieldRequiredMarkMode.Required;
    item.Caption = "x";
    item.SetTemplateContent(c => {
        Html.DevExpress().DropDownEdit(dde => {
            dde.Name = "UnitPrice";
            dde.Width = Unit.Percentage(100);
            dde.Properties.ValidationSettings.RequiredField.IsRequired = true;
            dde.Properties.ValidationSettings.Display = Display.Dynamic;
        }).Render();
    });
});
See Also