BootstrapGridViewBuilderBase<T>.Templates(Action<BootstrapGridViewTemplatesBuilder>) Method

Provides access to the templates used to display the Grid View's elements (cells, rows, etc.).

Namespace: DevExpress.AspNetCore.Bootstrap

Assembly: DevExpress.AspNetCore.Bootstrap.v18.2.dll


public T Templates(
    Action<BootstrapGridViewTemplatesBuilder> config
Public Function Templates(
    config As Action(Of BootstrapGridViewTemplatesBuilder)
) As T


Name Type Description
config Action<BootstrapGridViewTemplatesBuilder>

An Action that configures the BootstrapGridViewTemplatesBuilder class.


Type Description

A reference to this instance after the operation is completed.



Bootstrap Controls for ASP.NET Core are in maintenance mode. We don’t add new controls or develop new functionality for this product line. Our recommendation is to use the ASP.NET Core Controls suite.

$1 A template is a set of HTML elements that define the layout for a particular element (area) of a control. Grid View provides multiple templates that can be accessed via the Templates property. You can provide templates used for displaying cells, column headers, data rows, preview sections, etc.

Preview Row


Online Demo: For more information on templates, refer to the Templates online demo.

The example below illustrates how to create a template to display images along with textual content within preview rows.

@model IEnumerable

    .Settings(settings => settings.ShowPreview(true))
    .PreviewFieldName(m => m.Notes)
    .Templates(templates => templates
        .PreviewRow(t => @<text>
            <div class="media">
                    .Name("preview" + t.VisibleIndex)
                    .CssClasses(css => css.Control("rounded-circle"))
                    .Value(t.Eval(m => m.Photo)))
                <div class="media-body">@t.Text</div>
    .KeyFieldName(m => m.EmployeeID)
    .Columns(columns => {
        columns.Add(m => m.Photo);
        columns.Add(m => m.Text);
See Also