Set the NoRecords Template from Controller


Product Grid for ProgressĀ® TelerikĀ® UI for ASP.NET Core
Product Version 2019.1.220


How can I set the NoRecords Template message to content from the controller?


Using a Kendo UI Template, pass the text using the controller's ViewData. Then, configure the Kendo UI Grid's NoRecords TemplateID with the ID of the Kendo UI Template.

    .mystyle {
        color: red;
        font-size: 26px;
        .Columns(columns =>
            columns.Bound(p => p.OrderID).Filterable(false);
            columns.Bound(p => p.Freight);
            columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}");
            columns.Bound(p => p.ShipName);
            columns.Bound(p => p.ShipCity);
        .NoRecords(e => e.TemplateId("myTemplate"))
        .HtmlAttributes(new { style = "height:550px;" })
        .DataSource(dataSource => dataSource
            .Read(read => read.Action("Orders_Read", "Grid"))

<script type="text/x-kendo-template" id="myTemplate">
    <div class="mystyle">@ViewData["NoRecords"]</div>
public class HomeController : Controller
    public IActionResult Index()
        ViewData["NoRecords"] = "Custom No Data Message";
        return View();

See Also

In this article
Not finding the help you need? Improve this article