How can I implement server-side paging between web service and RadGridView?

1 Answer 51 Views
DataPager GridView
Alain
Top achievements
Rank 1
Alain asked on 03 Feb 2022, 02:54 PM

How I can do server-side paging/sorting/filtering in a RadDataGrid. I retrieve the data from an azure function and I don't want to retrieve all data from the database. I pass as a parameter to the azure function, the page index, and the page size.  the response returns the result of the LINQ query with Skip(page index) and Take(page Size), and total row count.

Thank you for your help.

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin Ivanov
Telerik team
answered on 07 Feb 2022, 01:17 PM

Hello Alain,

To achieve your requirement you can implement the updates from and to the database manually. You can see the available API in the Managing Data section of RadGridView's documentation. The following list shows one way to implement your requirement.

  • You can create a wrapper class for the rows in the GridView that will hold the rows information received from the server. You can assign a collection of the wrappers to the ItemsSource property of RadGridView.
  • When you receive new data from the server, you can update the ItemsSource accordingly.
  • When add, remove or update actions occur in the GridView, you can use the associated events and make the http requests to the server.
  • For the paging, you can use the PageIndexChanged event of RadDataPager. In the event handler, you can create the http request using the PageIndex and PageSize properties of RadDataPager. And when you get the response results, you can update the ItemsSource of RadGridView.

I hope this information was useful.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DataPager GridView
Asked by
Alain
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or