Skip to main content

GridViewSettings.SetDataRowTemplateContent(Action<GridViewDataRowTemplateContainer>) Method

Allows you to specify a data row template.

Namespace: DevExpress.Web.Mvc

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

NuGet Package: DevExpress.Web.Mvc5

Declaration

public void SetDataRowTemplateContent(
    Action<GridViewDataRowTemplateContainer> contentMethod
)

Parameters

Name Type Description
contentMethod Action<GridViewDataRowTemplateContainer>

A method to which a template content rendering is delegated.

Remarks

Note

Once a template defined using the SetDataRowTemplateContent method is created, it is instantiated within a container object of the GridViewDataRowTemplateContainer type. This container object exposes a set of members which can be useful when designing a template.

@Html.DevExpress().GridView(settings => {
    settings => {
        settings.Name = "gridView";
        ...
        settings.SetDataRowTemplateContent(context =>
        {
            ViewContext.Writer.Write("<span style=\"color:red\">TEST</span>");
        });
        ...
}).Bind(Model).GetHtml()

Online Demo

GridView - Templates

See Also