We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Synchronizing Multiple Grids'' Scrolling

Thread ID:





21805 Nov 23,2004 12:49 PM UTC Nov 30,2004 09:42 AM UTC WinForms 7
Tags: GridControl
John Bowm
Asked On November 23, 2004 12:49 PM UTC

Hi, I''ve got multiple grids that need to have their vertical scrolling synchronized. I searched the knowledge base and found a reference to Q10530. I tried doing what the text briefly describes, but it doesn''t quite work right. I get into a continuous scrolling on the selected grid, until it runs out of stack space. Unfortunately, I can''t retrieve the example code from the link. IE is complaining the site does not exist. Can someone send me the example code from this aritcle and/or help me stop the continuous scrolling effect? TIA, John

Administrator [Syncfusion]
Replied On November 23, 2004 05:00 PM UTC

We have had some web woes in the last day or so, and have had to move some things around. As a result, that link was broken. That download link from the KB should be working now.

John Bowm
Replied On November 23, 2004 07:15 PM UTC

Clay, Thanks for hunting down the link. I managed to get the .ZIP file OK. I''ll let you know if I still can''t resolve it after going through the example code. John

John Bowm
Replied On November 29, 2004 04:58 PM UTC

Clay, Now that I''m back from vac. I''ve been trying to make this work. But alas, it doesn''t. Here''s the details. I''ve got a tab control that has 1 grid on each tab page. The number of tabs (& therefore number of grids, as well as their respective names) is dynamically determined at run time and can vary when the tab control is created/loaded w/ data. Thus, in the OnTopRowChanged event handler, I must roll through all the grids present and update their respective TopRowIndex accordingly. Here''s my current code: //Roll through all the grids we have and set their TopRowIndex to this one''s. try { int CurrrentGridsTopRowIdx = e.SavedValue; Syncfusion.Windows.Forms.Grid.GridControl CurrGrid = (Syncfusion.Windows.Forms.Grid.GridControl)sender; foreach(TabPage tbCurrPage in m_tbCtrl.TabPages) { Syncfusion.Windows.Forms.Grid.GridControl NextGrid = GetCurrentPageGrid(tbCurrPage); if (CurrGrid.Name != NextGrid.Name) { NextGrid.TopRowIndex = CurrrentGridsTopRowIdx; NextGrid.Refresh(); } } } catch(Exception eAll) { //Force this one up the UI level. throw new Exception(eAll.InnerException.Message); } Note that the GetCurrentPageGrid(tbCurrPage) call simply loops through all the controls on the passed in tabpage and locates the grid object and returns the 1st one it finds. Any more ideas? Thanks again! John

Administrator [Syncfusion]
Replied On November 29, 2004 05:35 PM UTC

It seems to work for me in this sample. TabPages_7151.zip

John Bowm
Replied On November 29, 2004 05:48 PM UTC

Clay, Thanks for the "fixed code".. & so fast. That seems to do it. However, I came up w/ an alternative that also seemds to work that I would like your opinion on. Basically, I could handle the Tab Control''s SelectedIndexChanged event and then compare the PreviouslySelectedGrid.TopRowIndex vs NewlyelectedGrid.TopRowIndex and if different update the NewlySelectedGrid.TopRowIndex. Do you see any (dis)advantages using either approach? Thanks again, John

Administrator [Syncfusion]
Replied On November 29, 2004 09:40 PM UTC

I think your solution is fine as long as you only care about the visible grid having its toprowindex set. The other (nonvisible) grids will still have their old toprowindex. As long as this is ok with your requirements, then I think it is fine.

John Bowm
Replied On November 30, 2004 09:42 AM UTC

Clay, Thanks again for the help & opinion. Now to determine which one and implement it for real... John


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon