After getting a DataTable back from a stored procedure call, I'm adding empty rows to the datatable so the user can enter more data into it. The issue is that after assigning the datatable to the ultragrid datasource property, the scrollbar moves all the way to the end. The user will not be able to see the existing rows that were populate in the datatable by the stored procedure call.
Is there a way to have the active row as the first row or set the scroll bar to the top?
Here is the code:
dtRBMOverride = vprDataTable.LoadSP("rbmSelOverride", sqlParams.ToArray());for (int i = 0; i < 99; i++){ var row = dtRBMOverride.NewRow(); dtRBMOverride.Rows.Add(row);}ultraGrid1.DataSource = dtRBMOverride;
This is what I have tried so far with no success:
ultraGrid1.Rows[0].Selected = true;ultraGrid1.DisplayLayout.RowScrollRegions[0].ScrollPosition = 0;ultraGrid1.DisplayLayout.RowScrollRegions[0].Scroll(RowScrollAction.Top);ultraGrid1.ActiveRowScrollRegion.Scroll(RowScrollAction.Top);this.ultraGrid1.DisplayLayout.RowScrollRegions[0].FirstRow = this.ultraGrid1.ActiveRow.ParentRow;
private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e){ e.Layout.Override.AllowMultiCellOperations = Infragistics.Win.UltraWinGrid.AllowMultiCellOperation.All; e.Layout.ScrollBounds = ScrollBounds.ScrollToFill;}
UltraGridRow row = this.ultraGrid1.DisplayLayout.Bands[0].AddNew(); row.ParentCollection.Move(row, 0); this.ultraGrid1.ActiveRowScrollRegion.ScrollRowIntoView(row);