Grid - Paged Json DataSource with ASP.NET

3 posts, 1 answers
  1. Ivo
    Ivo avatar
    2 posts
    Member since:
    Oct 2016

    Posted 25 Oct Link to this post

    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. Answer
    Stephen
    Stephen avatar
    86 posts
    Member since:
    Jan 2011

    Posted 25 Oct in reply to Ivo Link to this post

    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.

  3. Kendo UI is VS 2017 Ready
  4. Ivo
    Ivo avatar
    2 posts
    Member since:
    Oct 2016

    Posted 28 Oct Link to this post

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

Back to Top