How to find current Scrolled Row

5 posts, 1 answers
  1. Shanti 😎
    Shanti 😎 avatar
    28 posts
    Member since:
    Jun 2016

    Posted 11 Feb Link to this post

    Hi,
    If i Scroll to n'th row.
    RadGridView.TableElement.ScrollToRow(n)

    How to find current Scrolled row ?

    Thanks..

  2. Dimitar
    Admin
    Dimitar avatar
    24 posts

    Posted 11 Feb Link to this post

    Hello Shanti ,

    You can get the entire row that you have scrolled to and iterate through its cell values as follows:

    GridViewRowInfo currentRow = this.radGridView1.Rows[n] as GridViewRowInfo;
    foreach (GridViewCellInfo cell in currentRow.Cells as GridViewCellInfoCollection)
    {
        Console.WriteLine(cell.Value);
    }
    

    You can find more information about GridViewRowInfo on the following article: https://docs.telerik.com/devtools/winforms/controls/gridview/rows/gridviewrowinfo

    I hope you find this information useful. Please do not hesitate to ask if you have further questions.

    Regards,
    Dimitar
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Shanti 😎
    Shanti 😎 avatar
    28 posts
    Member since:
    Jun 2016

    Posted 12 Feb Link to this post

    Hi,

    Thanks for reply..

    And if i scrolled to last row of gridview how to identify scroll end ?

     

     

  4. Answer
    Dimitar
    Admin
    Dimitar avatar
    24 posts

    Posted 12 Feb Link to this post

    Hello Shanti,

    If you would like to determine if you have scrolled to the last row of RadGridVIew you can achieve this by subscribing to the ValueChanged event of VerticalScrollBar. Then you can calculate whether the current VerticalScrollBar value is equal to the maximum value:

    this.radGridView1.TableElement.VScrollBar.ValueChanged += VScrollBar_ValueChanged;


    private void VScrollBar_ValueChanged(object sender, EventArgs e)
    {
        int scrollBarMaxValue = (this.radGridView1.TableElement.VScrollBar.Maximum - this.radGridView1.TableElement.VScrollBar.LargeChange) + 1
        int scrollBarCurrentValue = this.radGridView1.TableElement.VScrollBar.Value;
    
        if (scrollBarCurrentValue == scrollBarMaxValue)
        {
            //TODO Implement your code
        }
    }
    

    Please note that the value of a scroll bar cannot reach its maximum value through user interaction at run time. The maximum value that can be reached is equal to the Maximum property value minus the RadScrollBarElement.LargeChange property value plus 1. The maximum value can only be reached programmatically.

    Regards,
    Dimitar
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Shanti 😎
    Shanti 😎 avatar
    28 posts
    Member since:
    Jun 2016

    Posted 12 Feb in reply to Dimitar Link to this post

    Thank you Dimitar! It worked perfect.. ๐Ÿ˜Š๐Ÿ™Œ
Back to Top