Grid NoRecordsTemplate Setup

4 posts, 0 answers
  1. Sam
    Sam avatar
    22 posts
    Member since:
    May 2012

    Posted 14 Sep 2012 Link to this post

    good morning everyone,

    I am currently using the licensed version of Kendo UI Complete for ASP.NET MVC (Q2 2012) and trying to figure out if the Kendo UI Grid has something similar to the NoRecordsTemplate method in the Telerik Extensions for ASP.NET MVC Grid?

    Before this, I was using the licensed version of Telerik Extensions for ASP.NET MVC.  Below is the code I had for it.  You'll notice, there is a "NoRecordsTemplate" method which I can specify my own custom text if the grid is empty, has no records.  

    @{Html.Telerik().Grid(Model)
        .Name("grdAllUsers")
        .DataKeys(keys => keys.Add(k =>
            k.Id)
        )
        .Columns(columns =>
        {
            columns.Bound(o => o.FirstName)
                .Width(150);
            columns.Bound(o => o.LastName)
                .Width(150);
            columns.Bound(o => o.EmailAddress)
                .Width(200);
            .Width(70)
            .HtmlAttributes(new { style = "text-align:center" });
        })
        .NoRecordsTemplate(@<text>No User records to display.</text>)
        .Pageable(paging =>
            paging.PageSize(15)
        )
        .Sortable()
        .Filterable()
        .Render();
    }

    Below is my Keno UI Grid code.  How does one specify custom text when there are no records for the grid, when the grid is empty?

    @{Html.Kendo().Grid(Model)
        .Name("grdAllUsers")
        .Columns(columns =>
        {
            columns.Bound(o => o.FirstName)
                .Width(150);
            columns.Bound(o => o.LastName)
                .Width(150);
            columns.Bound(o => o.EmailAddress)
                .Width(200);
            .Width(70)
            .HtmlAttributes(new { style = "text-align:center" });
        })
        .Pageable(paging =>
            paging.PageSize(15)
        )
        .Sortable()
        .Filterable()
        .Render();
    }

    Thank you very much for your help
  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2592 posts

    Posted 14 Sep 2012 Link to this post

    Hello Sam,

    I am afraid NoRecordsTemplate is not available in Kendo UI Grid for ASP.NET MVC. By design the "No records to display" message is shown within the pager. For more details on the subject please check this topic from our online documentation.

    Kind regards,
    Iliana Nikolova
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Musashi
    Musashi avatar
    20 posts
    Member since:
    Jan 2014

    Posted 14 Sep Link to this post

    Version I'm using (2016.2.607) supports .NoRecords(string) or .NoRecords(Action<GridNoRecordsSettingBuilder>), and displays this in the grid's data area.
  5. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    347 posts

    Posted 19 Sep Link to this post

    Hi,

    The initial thread post and respective answer are rather outdated. The Kendo UI Grid supports the NoRecords template configuration for more than a year:

    http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/configuration#no-records-template

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-noRecords.template

    Please open a new thread if you have any questions, or experience any issues with the discussed functionality.

    Regards,
    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top
Kendo UI is VS 2017 Ready