Winforms Datagrid with server side pagination with custom sql query?

2 Answers 87 Views
GridView
Alexis
Top achievements
Rank 1
Iron
Iron
Alexis asked on 27 Nov 2023, 05:44 PM

Hi how i can manage datagrid but instead of client side pag use server side pagination? right now im loading a sql table with 50k, i dont like to see all 50k records,i will like to only display lets say 200 records per page. Any tips?

note: i know SQL server have an option in the select query to add a LIMIT and OFFSET i think

thank you

2 Answers, 1 is accepted

Sort by
1
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 29 Nov 2023, 10:51 AM

Hello Alexis,

The Paging mechanism of the RadGridView will be applied to the items from the control DataSource property. For example, you have created a query that returns a collection of 50 items. This collection is applied to the RadGridView DataSource property. If we set the PageSize property to 10, you will get 5 pages with 10 items per page. The pagination mechanism will be applied on the client side.

Regards,
Dinko | Tech Support Engineer
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.

Alexis
Top achievements
Rank 1
Iron
Iron
commented on 29 Nov 2023, 01:55 PM

any chance to custom those colors of pagination?
Dinko | Tech Support Engineer
Telerik team
commented on 29 Nov 2023, 02:17 PM

You can check the Paging Panel help article in our documentation. The article describes the paging control structure. Through the PagingPanelElement property, you can get access to each element in the panel. For example:

radGridView1.GridViewElement.PagingPanelElement.FirstButton

Then you can customize the buttons per your requirement.

Alexis
Top achievements
Rank 1
Iron
Iron
commented on 29 Nov 2023, 02:27 PM

Any real example? To change font size for example
Dinko | Tech Support Engineer
Telerik team
commented on 30 Nov 2023, 01:05 PM

You can use the Font property of the PagingPanelElement:

 radGridView1.GridViewElement.PagingPanelElement.Font = new Font(radGridView1.GridViewElement.PagingPanelElement.Font.FontFamily,18);

Here is the result:

 

1
Dinko | Tech Support Engineer
Telerik team
answered on 28 Nov 2023, 12:40 PM

Hi Alexis,

You could check this forum thread where similar behavior was discussed. In a few words, RadGridView doesn't offer server-side paging functionality. You could consider using RadVirtualGrid control as suggested in the forum.

Regards,
Dinko | Tech Support Engineer
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.

Alexis
Top achievements
Rank 1
Iron
Iron
commented on 28 Nov 2023, 12:50 PM

so i cant load like 50 records in first page and have page number so client may navigate between pages?
Tags
GridView
Asked by
Alexis
Top achievements
Rank 1
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or