Custom Data Binding to GridView on Click of Pagination Number

I want to Bind the GridView Depend on Pagination Number Click..
And while binding, I need to check which page is clicked and which records are going to bind...
For e.g.
I have 150 records in the Database Table. And my Page size is 25. So normally GridView will bind with 6 Pages.
If I have clicked on 4th Page number then I need that the Grid must be bind the records between row numbers 75 to 100
LVL 19
Manoj PatilSr. Software EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kamal KhaleefaInformation Security SpecialistCommented:
if you are using the built in paging then just add this code
 Private Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
        GridView1.PageIndex = e.NewPageIndex
        LoadMyDate()' where this is a function to fill ur gridview
    End Sub

Open in new window

now you can using something else which is called database paging
and here u need to pass the current page index and page size to the data base to get the corresponding data
Manoj PatilSr. Software EngineerAuthor Commented:
Your code will bind all Database at once.. I need to bind the records depend on the page number and page Size

Can you show me the Custom Pagination not Built in
But in C#
Kamal KhaleefaInformation Security SpecialistCommented:

you may to refer to this link which will guide you how to do it

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Manoj PatilSr. Software EngineerAuthor Commented:
Hi thanks for your solutions..
Well explained....
Since only URL can not accepted..
Because we need to think for future reference also (if the link will be deleted)
So I have attached the PDF of the same URL

Manoj PatilSr. Software EngineerAuthor Commented:
Thanks for solution...
Refer my last comment for PDF version of the same solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.