If I understand correctly anytime you set the UltraGrid.Datasource to a dataset the grid's existing rows are blown away. If this is the case, how do you update one or two rows with the latest values without resetting the datasource. The goal of this inquiry is to find a way to update a few records (1 or 2) with the latest values without having to redraw the entire grid. I know of the UltraGridRow.Refresh which seems to be useful if I knew how to refresh the underlying data without redrawing the grid.
Thanks for the help, Aaron
Hi Aaron,
What kind of data source are you using? If you are using a DataSet, DataTable, UltraDataSource, or any other robust data source that implement IBindingList, then you don't have to do anything. IBindingList will notify the grid of any changes to the data source automatically. So simply added a row to a DataTable bound to the grid will update the grid with the new row without writing any code.
If you are using a simpler data source like an IList, then you can update the data source and use the grid.Rows.Refresh method to force the grid to re-load the data. I'm not sure what you mean by you last sentence where you mention refreshing the underlying data without redrawing the grid.
It's a dataset. What I meant about 'refreshing the underlying data without redrawing the grid' is that I wanted a way to update the dataset with any changes and then update with those changes without having to reload the entire grid. This makes sense because only of the records would be affected at a time. The rest of the records are just historical info that will remain static.
I think I'm going to use the DataTable.LoadDataRow method. This will update the values of an existing record. It if it doesn't exist it will add a new record. I will then call Infragistics Refresh method to update the grid. One question - Without additional coding, I may not know the exact row in the grid that is changing. How much difference in performance is there if I run the UltraGrid.Refresh method vs. UltraGridRow.Refresh? I am massaging the data on InitializeRow event for the specific row that's being updated but that's about it.
Mike, I read some of your other postings and I think I've gathered what I need to know.
In summary of what I've learned:
· DataTable.LoadDataRow will update an existing record with new values or add a new record if it doesn't exist.
· If the UltraGrid.DataSource is a dataset then changes made to that dataset will automatically update the Grid without having to call Refresh.
· The InitializeRow event is fired for each record that was changed.
Thanks Mike for the help!