Recovering a deleted record in an UltraWinGrid

Posted by kopfb on 21-Sep-2010 08:03

In an example, I have an grid that is updateable. When the user presses the delete key, the dataset behind the grid is passed to a validation procedure. If the validation checks are not passed, I set the error-string on the buffer(s), set the dataset to error etc. Once I have rejected the changes and so on, the row that was previously deleted shows back up in the grid as I would expect. The problem I am having is how to get the record to show back up in the row position it was originally in. Currently, it shows up as the last record at the bottom of the grid. For a while I thought it wasn't showing up at all because I did not realize its new position. At any rate, I am currently using the statement:

ultraGrid1:PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction:LastRowInGrid).

What this does is scroll the grid to the last record and make it active and hightlight right after I display an error message to the user as to why the delete failed validation. The problem is that this could cause users some grief as it could move them far from their current position in the grid. The only way I have been able to have the row show back up where it was originally positioned at was if a column in the grid was previously sorted and then using the statement:

ultraGrid1:DisplayLayout:Bands[

0]:SortedColumns:refreshsort(TRUE).

Does anyone know how to get the row back to it original row position?

Thanks,

Brad

All Replies

Posted by danielStafford on 21-Sep-2010 10:55

I would follow Peter Judge's excellent advice in the thread titled "Event Handlers firing backwards" (use the search feature) .

Basically, you reopen the query and reposition to the relevant row.

This thread is closed