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

TopRowIndex to scroll grid up

Using grid, we are using TopRowIndex to set the top row of our virtual grid. When the row we want to set as the TopRowIndex is close to the bottom of the grid, the grid is not scrolled completely to that row as the top, since that would leave "empty" space below it in the bounds of the grid. example: grid has 100 rows, 30 fit on a "page" in the grid, set TopRowIndex = 90, the top row will actually be 70. Is there any way to change/turn off this behavior so the top row is really set with TopRowIndex?

7 Replies

AD Administrator Syncfusion Team November 1, 2004 02:47 PM UTC

I think you will have to handle this yourself. In the TopRowChanging event, check the new value. If it will leave empty space, then you can change it. You could try using this.gridControl1.ViewLayout.VisibleRows and this.gridControl1.RowCount to see whether teh new value should be adjusted.

DA Dan November 2, 2004 02:12 PM UTC

Thanks Clay. Not sure I understand your suggestions. I added a handler for the TopRowChanging event, but it''s not fired by the grid in this situation. When I set TopRowIndex to something that will cause the grid to scroll, the event fires. If the TopRowIndex is set to a row near the bottom (within VisibleRows of the bottom of the grid), then the event doesn''t fire. If the event doesn''t fire in the case where I''d want to do some special processing, not sure I understand what you meant in your suggestions. Thank you!

AD Administrator Syncfusion Team November 2, 2004 03:33 PM UTC

I think I misread your question before. You want to see empty space under the bottom of the grid. I thought you wanted to avoid this empty space. Here is a rough try at this by deriving the grid and overriding SetTopRow. It showed blank space using But I am not sure if the methods I used were exposed in or not. WindowsApplication5_4790.zip

CV Catinat Velmourougan October 21, 2005 06:06 AM UTC

hi, I am using a ggc.My top row index works fine without the grouping.When theres grouping the toprowindex doesnt work fine.It behaves erratic. Can you suggest how to improve it? regards, catinat

AD Administrator Syncfusion Team October 21, 2005 07:08 AM UTC

TopRowIndex is inherited from GridControlBase, so it has no knowledge of things like groups, summaries, etc that are part of the GridGroupingControl. What are you trying to do with the TopRowIndex? How are you trying to use it? There may be another way to do what you want in the GridGroupingControl.

CV Catinat Velmourougan October 21, 2005 08:13 AM UTC

hi, We have a find functionality on the grid grouping control. When we find the correct record, we need to set it as the current record.We use the toprowindex to bring the found record to the top. How can we achieve this? regards, catinat

AD Administrator Syncfusion Team October 21, 2005 12:13 PM UTC

Try code like: // rec is the GridRecord you want to scroll if(rec.ParentGroup != null) rec.ParentGroup.IsExpanded = true; int i = this.gridGroupingControl1.Table.DisplayElements.IndexOf(rec); this.gridGroupingControl1.TableControl.TopRowIndex = i; //if you want to set it current or select it rec.SetCurrent(); rec.SetSelected(true);

Live Chat Icon For mobile
Up arrow icon