Scroll to a row

3 posts, 0 answers
  1. Ramius
    Ramius avatar
    127 posts
    Member since:
    Feb 2008

    Posted 28 Feb 2009 Link to this post

    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. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 03 Mar 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ramius
    Ramius avatar
    127 posts
    Member since:
    Feb 2008

    Posted 03 Mar 2009 Link to this post

    Hello Martin,

    thank you for your help.
    It works fine now.

    Kind Regards,

    Ramius
Back to Top