New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Template Columns

Template columns enable you to cusomize the way data is displayed based on your specific preferences.

The following example demonstrates how to specify your own custom layout for the Grid columns by using images and property bindings from the underlying data source. The templates are defined by using JavaScript functions.

        .Columns(columns =>
            columns.Bound(c => c.ContactName).Width(140).ClientTemplate("#=template(data)#");
            columns.Bound(c => c.ContactTitle).Width(190);
            columns.Bound(c => c.CompanyName);
            columns.Bound(c => c.Country).Width(110);
        .HtmlAttributes(new { style = "height: 380px;" })
        .Pageable(pageable => pageable
        .DataSource(dataSource => dataSource
            .Read(read => read.Action("Customers_Read", "Grid"))

        function template(data) {
            return `<div class='customer-photo'
                    style= 'background-image: url(${data.CustomerID}.jpg);' ></div >
                    <div class='customer-name'>${ data.ContactName} </div>

    <style type="text/css">
        .customer-photo {
            display: inline-block;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background-size: 32px 35px;
            background-position: center center;
            vertical-align: middle;
            line-height: 32px;
            box-shadow: inset 0 0 1px #999, inset 0 0 10px rgba(0,0,0,.2);
            margin-left: 5px;

        .customer-name {
            display: inline-block;
            vertical-align: middle;
            line-height: 32px;
            padding-left: 3px;
In this article