This is a migrated thread and some comments may be shown as answers.

Rad Grid view position after reload of the data

2 Answers 220 Views
GridView
This is a migrated thread and some comments may be shown as answers.
shijas
Top achievements
Rank 1
shijas asked on 20 Jun 2019, 10:04 AM

 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 Answers, 1 is accepted

Sort by
0
shijas
Top achievements
Rank 1
answered on 21 Jun 2019, 10:49 AM

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

0
Dimitar
Telerik team
answered on 24 Jun 2019, 10:52 AM
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.
Tags
GridView
Asked by
shijas
Top achievements
Rank 1
Answers by
shijas
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or