# Templates

The PropertyGrid allows you to control the appearance of the items values by using template options.

For more information on the capabilities and syntax of the templates, see the [Using Client Templates](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/helper-basics/using-client-templates) article. For a runnable example, refer to the [demo on customizing the templates in the PropertyGrid](https://demos.telerik.com/aspnet-mvc/propertygrid/templates).

The following example demonstrates how to use the `TemplateHandler()` option to customize the value of an item that has child items.

```Razor HtmlHelper
    @(Html.Kendo().PropertyGrid<PropertyViewModel>()
        .Name("propertyGrid")
        .Items(items =>
        {
            items.Add().Field("font").TemplateHandler("fontTemplate")
            .Items(childItems =>
            {
                childItems.Add().Field("fontWeight");
                childItems.Add().Field("fontFamily");
            });
        })
        ... //Additional configuration
    )
```

```JS scripts
    <script>
        function fontTemplate(data) {
            var propertyGridModel = $("#propertyGrid").data('kendoPropertyGrid').model();
            return `<span class="fontWeight">${propertyGridModel.font["fontWeight"]}</span> <span class="fontFamily">${propertyGridModel.font["fontFamily"]}</span>`;
        }
    </script>
```

The following example demonstrates how to create an inline string template by using the `Template()` option.

```Razor HtmlHelper
    @(Html.Kendo().PropertyGrid<PropertyViewModel>()
        .Name("propertyGrid")
        .Items(items =>
        {
            items.Add().Field(f => f.color).Template("<i><span style='color:#=value#'>#=value#</span></i>")
            .Editor(editor => editor
                .DropDownList()
                .BindTo(new string[] { "red", "green", "blue", "purple", "orange" }));
        })
        ... //Additional configuration
    )
```

## See Also

* [Templates in the PropertyGrid HtmlHelper for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/propertygrid/templates)
* [Using Client Templates](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/helper-basics/using-client-templates)
