HorizontalScrollingOffset in RadGridView

2 posts, 1 answers
  1. Amir
    Amir avatar
    1 posts
    Member since:
    Sep 2018

    Posted 16 Sep 2018 Link to this post

    How can I get HorizontalScrollingOffset with RadGridView?

    I'm trying to refresh the grid and keep the screen in the same horizontal position, I succeeded to do it in vertical position.

    Thanks in advance

    Amir

  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3754 posts

    Posted 17 Sep 2018 Link to this post

    Hello, Amir, 
     
    In order to restore the horizontal offset after refreshing, you should keep the TableElement.HScrollBar.Value. You can find below a sample code snippet: 
     
    private void radButton1_Click(object sender, EventArgs e)
    {
        int horizontalScrollValue = this.radGridView1.TableElement.HScrollBar.Value;
        this.radGridView1.DataSource = null;
        this.radGridView1.DataSource = this.productsBindingSource;
        this.radGridView1.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.AllCells);
        this.radGridView1.TableElement.HScrollBar.Value = horizontalScrollValue;
    }
     
    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 


    Should you have further questions please let me know.

    Regards,
    Dess
    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.
Back to Top