Edit this page

Set Configuration Property Globally on the Server for Multiple Grids

Environment

Product ProgressĀ® Kendo UIĀ® Grid for ASP.NET MVC
Product Version 2018.2.620

Description

How can I add No Data Found as a global template for all Grid in my application and show it when no records are available?

Solution

  1. Create a custom Kendo UI Grid HtmlHelper.
  2. In the custom HtmlHelper, set the NoRecords property.

    The following example demonstrates how to create a custom MyGrid HtmlHelper.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using Kendo.Mvc.UI;
    
    namespace MyNamespace
    {
        public static class MyHtmlHelperExtensions
        {
            public static Kendo.Mvc.UI.Fluent.GridBuilder<T> MyGrid<T>(this HtmlHelper helper, string name)
                where T : class
            {
                return helper.Kendo().Grid<T>()
                .NoRecords("No data found");
            }
        }
    }
    
  3. Use Html.MyGrid instead of Html.Grid.

    @(Html.MyGrid<Model>()
      .Name("grid")
      .Columns(columns =>
      {
       ...
      })
      .DataSource(dataSource => dataSource
       ...   
      )
    )
    
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy