Custom Data Binding to GridView on Click of Pagination Number

Posted on 2014-07-15
Last Modified: 2014-08-14
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
Question by:Manoj Patil
    LVL 16

    Expert Comment

    by:Kamal Khaleefa
    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
    LVL 19

    Author Comment

    by:Manoj Patil
    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#
    LVL 16

    Accepted Solution


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

    Author Comment

    by:Manoj Patil
    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

    LVL 19

    Author Closing Comment

    by:Manoj Patil
    Thanks for solution...
    Refer my last comment for PDF version of the same solution.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now