Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Cannot update unbound column after Sort
posted

I have records stored in a DataTable that is bound to an UltraWinGrid.UltraGrid.  I also have SortMulti enabled and I am able to successfully sort on any combination of columns.

Since the sorting causes the Record ID column to be completely unsorted most of the times (as a result of sorting on other columns), I decided to insert an UNBOUND column called "RowID".  

This way, after each time a sorting occurs, I re-write to the RowID column using the grid's AfterSortChange() event.  Example:  RowID = 1, 2, 3, 4, etc.  The problem is that when I do this, my RowID values appear to NOT be updated.  However, after much experimentation, I have come to the conclusion that my attempt to iterate through the Rows collection is a waste of time.  This is because I believe that the ordinal positions of the rows have also been re-arranged due to the sort.

Does anyone have a suggestion on how I can get this working?  I've tried numerous ideas and they all fail -- because of the re-arranged row indexes caused by the sorting.  At least,...this is my belief.