This is a migrated thread and some comments may be shown as answers.

Grid NoRecordsTemplate Setup

6 Answers 981 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 14 Sep 2012, 06:53 AM
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

6 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 14 Sep 2012, 07:14 AM
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!
0
Musashi
Top achievements
Rank 1
answered on 14 Sep 2016, 05:33 PM
Version I'm using (2016.2.607) supports .NoRecords(string) or .NoRecords(Action<GridNoRecordsSettingBuilder>), and displays this in the grid's data area.
0
Dimiter Topalov
Telerik team
answered on 19 Sep 2016, 06:41 AM
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.
0
Yeyuan
Top achievements
Rank 1
answered on 14 Nov 2017, 09:22 PM

Hey.

it has to be a string inside the Template.

I did the following, and it works great.

.NoRecords(n => n.Template("<div style='font-size: larger; color: orange; '>Uh-oh, there's no data!</div>"))

 

Please refer to the ducumentation from Telerik: 

https://docs.telerik.com/aspnet-mvc/helpers/grid/configuration#non-centered-custom-message

 

Good luck!

 

0
Yeyuan
Top achievements
Rank 1
answered on 14 Nov 2017, 09:25 PM
0
Yeyuan
Top achievements
Rank 1
answered on 14 Nov 2017, 09:25 PM
Tags
Grid
Asked by
Sam
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Musashi
Top achievements
Rank 1
Dimiter Topalov
Telerik team
Yeyuan
Top achievements
Rank 1
Share this question
or