[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 642
  • Last Modified:

Custom Data Binding to GridView on Click of Pagination Number

Hello,
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.
Now,
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
0
Manoj Patil
Asked:
Manoj Patil
  • 3
  • 2
1 Solution
 
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
0
 
Manoj PatilSr. Software EngineerAuthor Commented:
Hi,
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#
0
 
Kamal KhaleefaInformation Security SpecialistCommented:
hi

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

http://www.codeproject.com/Articles/485531/ASP-NET-Pagination
0
 
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

http://www.codeproject.com/Articles/485531/ASP-NET-Pagination

ASP.NET-Custom-Pagination....-with-Perfo
0
 
Manoj PatilSr. Software EngineerAuthor Commented:
Hi,
Thanks for solution...
Refer my last comment for PDF version of the same solution.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now