I am doing a new UserControl in studio.
I then add the Telerik RadGridView to said control and change the Dock property to FILL.
When the grid loads I do
(dataSet is a DataSet that is a member of the usercontrol so is around for the life time of the control.
I then bind the data table to the control
Now I have a button on my app that simply adds data to the datatable
My problem is I can't figure out how to get the scroll bar to do what I want.
What I want is for the scroll bar to stay where it is in the collection while items are added to the bottom.
If I just straight up add the items to the dataTable my scroll bar jumps to the bottom.
I have tried doing:
But this causes the scroll bar to do some kind of odd warp where the bar grows and shrinks depending on where you are in the scroll.
The only way I could find to make the bar actually size correctly was
But that seems just silly, and while the scroll bar does size right it jumps to the top.
I am sure I am just making this harder than it needs to be, but I just can't seem to find a way to make the scroll bar stay where it is while I add items.
Any assistance on this would be greatly appreciated.
Thanks,
Ralph
I then add the Telerik RadGridView to said control and change the Dock property to FILL.
When the grid loads I do
if (dataSet == null) //TODO TESTING{ dataSet = new DataSet(); dataTable = dataSet.Tables.Add("Results");}dataTable.Columns.Add("ID");dataTable.Columns.Add("Name");dataTable.Rows.Add(i++, "Jack");dataTable.Rows.Add(i++, "Donna");dataTable.Rows.Add(i++, "Jack");dataTable.Rows.Add(i++, "Donna");dataTable.Rows.Add(i++, "Jack");dataTable.Rows.Add(i++, "Donna");dataTable.Rows.Add(i++, "Jack");dataTable.Rows.Add(i++, "Donna");dataTable.Rows.Add(i++, "Jack");dataTable.Rows.Add(i++, "Donna");dataTable.Rows.Add(i++, "Jack");dataTable.Rows.Add(i++, "Donna");(dataSet is a DataSet that is a member of the usercontrol so is around for the life time of the control.
I then bind the data table to the control
this.batchDisplay.DataSource = dataSet.Tables[0];Now I have a button on my app that simply adds data to the datatable
dataTable.Rows.Add(i++, "Ralph"); //TODO TEST CODEdataTable.Rows.Add(i++, "Walf");dataTable.Rows.Add(i++, "Ralph");dataTable.Rows.Add(i++, "Walf");My problem is I can't figure out how to get the scroll bar to do what I want.
What I want is for the scroll bar to stay where it is in the collection while items are added to the bottom.
If I just straight up add the items to the dataTable my scroll bar jumps to the bottom.
I have tried doing:
this.batchDisplay.BeginUpdate(); dataTable.Rows.Add(i++, "Ralph"); //TODO TEST CODE dataTable.Rows.Add(i++, "Walf"); dataTable.Rows.Add(i++, "Ralph"); dataTable.Rows.Add(i++, "Walf"); this.batchDisplay.EndUpdate(); this.batchDisplay.TableElement.RowScroller.UpdateScrollRange();But this causes the scroll bar to do some kind of odd warp where the bar grows and shrinks depending on where you are in the scroll.
The only way I could find to make the bar actually size correctly was
this.batchDisplay.BeginUpdate();dataTable.Rows.Add(i++, "Ralph"); //TODO TEST CODEdataTable.Rows.Add(i++, "Walf");dataTable.Rows.Add(i++, "Ralph");dataTable.Rows.Add(i++, "Walf");this.batchDisplay.Height += 1;this.batchDisplay.Height -= 1;this.batchDisplay.EndUpdate();But that seems just silly, and while the scroll bar does size right it jumps to the top.
I am sure I am just making this harder than it needs to be, but I just can't seem to find a way to make the scroll bar stay where it is while I add items.
Any assistance on this would be greatly appreciated.
Thanks,
Ralph
