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

Grid - Paged Json DataSource with ASP.NET

2 Answers 167 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Ivo
Top achievements
Rank 1
Ivo asked on 25 Oct 2016, 09:21 AM

We generate a Json DataSource with C# and passing it to a JavaScript var.

var gridAllMessagesData = <%= gridAllMessagesDataSource %>;

        $(document).ready(function() {
            $("#GRIDAllMessages").kendoGrid({
                dataSource: {
                    data: gridAllMessagesData,
                    ...

Beacause of this we have to load all Data at pageload, which causes very big performance issues.
Ist there any way to load only the grid page, which the user is visiting?

Or is there any best practice to pass data to a Kendo UI grid with ASP?

2 Answers, 1 is accepted

Sort by
0
Accepted
Stephen
Top achievements
Rank 2
answered on 25 Oct 2016, 12:52 PM

Don't load the entire dataset on page load.

Connect the grid's dataSource to a remote endpoint on your server that returns the data and either:

1. use server-side paging(where the server only returns the page requested by the grid by you using the request parameters to properly filter your data before returning just the requested page.

2. use client-side paging where the server action returns the entire dataset but the grid only renders(creates DOM elements for) 1 page at a time, with the rest of the data in javascript memory.

 

If your dataset is large, use server-side paging.

There is all kinds of documentation on this.  Start with looking at this server-side demo, http://demos.telerik.com/kendo-ui/grid/remote-data-binding and then look at the grid walkthrough, http://docs.telerik.com/kendo-ui/controls/data-management/grid/walkthrough, and pay particular attention to the section on Paging.

0
Ivo
Top achievements
Rank 1
answered on 28 Oct 2016, 01:11 PM

Thank you for the quick reply, it helped me a lot.

Tags
Data Source
Asked by
Ivo
Top achievements
Rank 1
Answers by
Stephen
Top achievements
Rank 2
Ivo
Top achievements
Rank 1
Share this question
or