Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want to achieve 2 functionalities as shown in the following pic:
Want to achieve this

  1. At the top, there is a dropdown box and which contains values like 5, 10, 20, 50 and on changing it, it should display number of records in datagridview as number selected from drop down.
    Like if I selected 20, then it should display 20 records in datagridview.
  2. I want to display pagination also as shown in the right hand side bottom.
    It should be dynamic and it should be relevant to drop down also.

Note: I am using MYSQL server as backend and fetching data from database using stored procedure.

What I have tried:

I have tried nothing. Just searching for a better solution as per my requirement.
Updated 1-Nov-23 10:09am

1 solution

Implementing pagination in a DataGridView in a C# Windows Forms application involves managing the data source and updating the DataGridView's content accordingly. To implement the additional features you've mentioned, you'll need to modify the existing code and add event handlers for the drop-down and pagination functionality. Further, you can take an insight from the example:
A Simple Way for Paging in DataGridView in WinForm Applications[^]
Share this answer
Maciej Los 2-Nov-23 11:40am    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900