Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

synchronise pagination 1

Status
Not open for further replies.

stephenk1973

Technical User
Jun 11, 2003
246
GB
I have a a large data set which i have split into two gridviews, one stationary, one horizontally scrollable. How can i get the pagination of both to synchronise?


Would be grateful of any examples or suggestions.

Thanks
Stephen
 
The GridView control has a PageIndexChanged event, so you can presumably find the relevant page that it has changed to from this event, and then change the second gridview's page to this value.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Found the event not sure how i can use it.

Any idea how you would capture the page being changed to? Would gridview1 have to change first before the second page thought about changing. Is there a way of calling both events at the same time?
 
If you convert the sender object to a GridView, you should be able to access it's PageInex property which will show you the current page that it is displaying. Use this value to change the second GridView's page.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Is what you want to do simply to sync the grids when the user selects a different page? Or am I missing something that is more complicated?

I simply created a page, dropped 2 gridviews on it. Set the datasource of each grid to the same datasource. Then wrote some simple code to keep the grids synced.

Code:
Protected Sub GridView1_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.PageIndexChanged
   GridView2.PageIndex = GridView1.PageIndex
End Sub

Protected Sub GridView2_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView2.PageIndexChanged
   GridView1.PageIndex = GridView2.PageIndex
End Sub

Jim
 
Cheers had just got there myself jbenson101.

Thanks for the help.
Stephen
 
Cool.. glad you got it working.. simpler than you thought, right? :)
Jim
 
So much is! Just had to break it down.

All the best

Stephen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top