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

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?


  1. Use a Kendo UI Template and pass the text by using the ViewData setting of the controller.
  2. Configure the NoRecords TemplateID of the Grid 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