Hi,
What is the best way to retain the active row when refreshing data? In a number of our systems the data will change as we update records (e.g. viewing outstanding orders and when we complete the record being viewed will no be displayed in the outstanding orders view).
Once we clear the dataset being used as the data source for the grid the active row is lost. We currently get around this by saving the ID of the active row before any refresh and then setting the active row based on this but is there an easier, more efficient way?
Regards
No, there is no other way. I use this way also. However, you can still write this logic in one place for all your grids. To do that:
1. Create a CustomControl that inherits UltraGrid and use it instead.
2. Handle AfterRowActivate and cache the row id.
2. Override OnListManagerSet method.
3. If you use a BindingSource, cache the BindingSource in the grid and handle ListChanged event and there set the active row by the cached id. If you don't, just set the active row any time OnListManagerSet is invoked.