Skip to main content

MVCxVerticalGridRow.SetDataItemTemplateContent(Action<VerticalGridDataItemTemplateContainer>) Method

Allows you to specify a template for the current row’s data cells.

Namespace: DevExpress.Web.Mvc

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

Declaration

public void SetDataItemTemplateContent(
    Action<VerticalGridDataItemTemplateContainer> contentMethod
)

Parameters

Name Type Description
contentMethod Action<VerticalGridDataItemTemplateContainer>

A method to which a template content rendering is delegated.

Remarks

Note

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

The code sample below demonstrates how to define the template for cells within an individual row.

@Html.DevExpress().VerticalGrid(settings =>
{
    settings.Name = "VerticalGrid";
    ...
    // Setting a template to render all the data cells within a "LastName" row
    settings.Rows.Add(row => {
        row.FieldName = "LastName";
        row.SetDataItemTemplateContent(cell => {
            ViewContext.Writer.Write("<b style=\"font-style:italic\">" + cell.Text + "</b>");
        });
    });
    settings.Rows.Add("FirstName");
    ...
}).Bind(Model).GetHtml()

Te image below illustrates the result.

MVC_VerticalGrid_DataCells_TemplateOneRow

See Also