This is a migrated thread and some comments may be shown as answers.

Scroll to a row

2 Answers 252 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ramius
Top achievements
Rank 1
Ramius asked on 28 Feb 2009, 03:55 PM
Hello,

scrolling to a row with:

radGridView1.GridElement.ScrollToRow( rownumber );

works fine in many cases but in the following 2 cases:

case 1:
The grid contains fewer rows than it can display.
For example the grid can display 10 rows and it contains only 5 rows.
Now i add a new row which appears as last row and use the ScrollToRow(6).

What happens:
I see only one row ( my newly added row number 6 )  and on the right sight a scrollbar appears.
For me it's very confusing to see only one row when i know that there are 5 more rows.

What should happen:
All rows of the grid should be displayed, because no scrolling is necessary and no scrollbar should appear.

case 2:
The grid contains more rows than it can display and the scrolling goes to a row in the range <MaxRows - DisplayableRows, MaxRows>.
For example the grid contains 99 rows and it can display 10 rows.
Now i add a new row  which appears as last row ( 100 ) and use the ScrollToRow( 100 )

What happens:
I see only one row ( my newly added row number 100 ).

What should happen:
The grid should show the rows 90 - 100.

Is it possible to solve the two cases ?

Kind Regards,

Ramius



2 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 03 Mar 2009, 12:32 PM
Hi Ramius,

Thank you for writing.

I have managed to reproduce the described behavior. We will consider changing this in some of the next releases. Currently you can change this by subtracting the visual rows count from the scroll index:

int visualRowsCount = this.radGridView1.GridElement.VisualRows.Count;  
 
this.radGridView1.GridElement.ScrollToRow(indexToScroll - visualRowsCount + 3); 

I have updated your Telerik points for bringing our attention on this matter. Do not hesitate to contact me again if you have other questions.

Greetings,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ramius
Top achievements
Rank 1
answered on 03 Mar 2009, 08:21 PM
Hello Martin,

thank you for your help.
It works fine now.

Kind Regards,

Ramius
Tags
GridView
Asked by
Ramius
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Ramius
Top achievements
Rank 1
Share this question
or