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

Synchronizing Multiple Grids'' Scrolling

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

7 Replies

AD Administrator Syncfusion Team 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. http://64.78.18.34/Support/article.aspx?id=10530


JB John Bowm 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


JB John Bowm 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


AD Administrator Syncfusion Team November 29, 2004 05:35 PM UTC

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


JB John Bowm 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


AD Administrator Syncfusion Team 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.


JB John Bowm 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

Loader.
Live Chat Icon For mobile
Up arrow icon