Vertical Scroll position

5 posts, 1 answers
  1. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 15 Nov 2012 Link to this post

    Hey Guys

    Scratching my head over this one.. I have a grid populated by an SQL query.

    On queries that require the vertical scroll bar to be shown , the first search displays with the Grid at the top of the results. ( scroll position at the top)

    If I just hit search again without touching anything else... the scroll goes to the last row every time.

    I have even tried setting this at the end of each search , but still the scroll appears at the end of the selection after the first populate.

     

    Me.RadGridView1.TableElement.ScrollTo(0, 0)

     

     

    I hate spending hours on something that is probably very easy !  It must be something I am doing to clear the Grid and repopulate it.. but haven't managed to find it!.

    Any hints / thoughts?

    Thanks

    Rob

     

  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 16 Nov 2012 Link to this post

    Hello Rob,

    There are a couple of things you can try here,
    The first one is to set the select last added row to false, like so:
    grid.MasterTemplate.SelectLastAddedRow = false;

    or after you are changing the data, you can select again the first row from the current view,
    this.grid.CurrentRow = this.grid.CurrentView.ViewInfo.Rows.FirstOrDefault();

    or you can just set the datasource to null before starting the search and set it again once the search is done,
    this.grid.DataSource = null;
    // search or do anything
    this.grid.DataSource = searchResultList;

    If you have any other questions, please let me know.

    Best Regards,
    Emanuel Varga
    WinForms MVP
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 20 Nov 2012 Link to this post

    Hello Rob,

    This issue appears because RadGridView synchronizes its current row with the underlying data source and its currency manager position. As Emanuel suggested you can change this behavior by setting the CurrentRow manually or by disabling it.

    If you have further questions, do not hesitate to contact us.
     
    All the best,
    Jack
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  5. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 20 Nov 2012 Link to this post

    Hey Guys

    I think this has solved it.. I'm  flat out trying to complete the solution for the customer , so just added the code and did a quick test.

    I think I may have seen it still scroll to the bottom once or twice over the last few days. So I may come back to this if I can reproduce it.

    Thank you for your help :0)

    Rob

  6. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 22 Nov 2012 Link to this post

    Hello Rob,

    I am glad to hear that everything is OK now. Do not hesitate to contact us if you have further questions.
     
    All the best,
    Jack
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top
UI for WinForms is Visual Studio 2017 Ready