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

KendoGrid Server side paging

1 Answer 1976 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MUDIAM
Top achievements
Rank 1
Veteran
MUDIAM asked on 09 Dec 2020, 10:51 PM

Hi,

We have recently changed some legacy code which was calling a WCF API to populate the grid and it was using serverside paging. We have to use the same serverside paging but with C# datasource. How can we achieve this?

This is how the code was before when it used an API:
dataSource: {
    type: "odata",
    transport: {
        read: dataUrl,
        dataType: "json"
    },
    schema: {
        model: BillingModel,
        data: function (data) {
            return data["value"];
        },
        total: function (data) { return data['odata.count']; }
    },
    serverPaging: true,
    serverFiltering: true,
    serverSorting: true,
    sort: { field: "EncounterDate", dir: "asc" }
}

This was changed to use the c# datasource now:

dataSource: {
    schema: {
        model: BillingModel,
    }
}

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 11 Dec 2020, 02:16 PM

Hello Mudiam,

Thank you for the provided code snippet.

In order to achieve the desired behavior, I would recommend using the following demo as a template. It represents the Custom Ajax binding of a DataSource:

Open the View Source tab and find the implementation of the "ApplyOrdersPaging" Method in the "CustomAjaxBindingController". Pass and use the "page" and "pageSize" parameters for "Skip" and "Take" methods. This is the recommended way to implement the Server-side paging.

Give the approach above a try and let me know if further assistance is needed.

Kind Regards,
Anton Mironov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
MUDIAM
Top achievements
Rank 1
Veteran
Answers by
Anton Mironov
Telerik team
Share this question
or