Rad Grid view position after reload of the data

3 posts, 0 answers
  1. shijas
    shijas avatar
    2 posts
    Member since:
    Jun 2019

    Posted 20 Jun Link to this post

     Grid position is not proper after reload the data. Winforms radgridview we are using.

    Grid is having huge data with headers and child grids (Nested grid).

    The issue is related to grid position after data save.

    User will expand the grid including header ,child and do some edits and save the records.

    After save the grid position we are trying to set from code. As a part of the save function grid data will be reloaded and then we are expanding the headers and child grid same as how the user kept.

    Below two properties are not consistent before save and after data reload.

     rdGrid.VerticalScroll.Maximum
     rdGrid.VerticalScroll.Minimum

    Other than setting these properties how we can set the grid position.  Thanks in Advance

     

     int position = vScroll.Maximum ;
     bool isMaxValue = position == vScroll.Maximum - vScroll.LargeChange + 1;

         if (isMaxValue)
                                {
                                    position = vScroll.Maximum - vScroll.LargeChange + 1;
                                }
                                rdGrid.TableElement.VScrollBar.Value = position;

     

  2. shijas
    shijas avatar
    2 posts
    Member since:
    Jun 2019

    Posted 21 Jun Link to this post

    Before save and after save & refresh of the grid I am getting different values for below properties. After refresh I am making all the expanded child grid same as before save.

                             int aIposition = rdGrid.TableElement.VScrollBar.Value;
                            int aImaxValue = rdGrid.TableElement.VScrollBar.Maximum;
                            int aIMinimum = rdGrid.TableElement.VScrollBar.Minimum;
                            int aIChange = rdGrid.TableElement.VScrollBar.LargeChange;

    so how to calculate the position of the grid after save & refresh.

    Before save & refresh values are 

    Max - 4041

    Large change- 709

    Position - 3333

    After Save & Refresh

    Max - 2163
    Large change- 709
    Position -0

  3. Dimitar
    Admin
    Dimitar avatar
    2743 posts

    Posted 24 Jun Link to this post

    Hi,

    Since you are using a hierarchy you need to save/restore the expanded states as well. I have used the approach from this article, and I have created an example that shows how you can save/restore the states and the scrollbar value. 

    I hope this helps. Should you have any other questions, do not hesitate to ask.
     
    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.
Back to Top