Currently I'm using the InitializeRow to set the color of the Row. This works fine until the datasource connected with the UltraGrid is changed. When that happens, no InitializeRow is executed. The values in the row change but I don't seem to find a way to detect this. If the values change, then the colors might also be changed.
I've tried AfterRowUpdate but that only gets fired if data goes from the UltraGrid to the Datasource... In my case a Refresh of the data might be done which recycles the existing rows not firing an InitializeRow event.
The colors vary according to a value of a column, so I do need to do it this way.
Thx, Lieven Cardoen
Hi Lieven ,
What kind of DataSource are you using? If your data source supports IBindingList and it sends a notification when cell values are modified, then the grid will fire InitializeRow. If not, then the grid will not know anything changes and there is no way the grid can fire an event.
Since you are saying that the grid display is updating correctly, that seems to indicate that the grid is getting a notification. So InitializeRow should be firing. Are you sure it's not?
You can manually force InitializeRow to fire by calling grid.Rows.Refresh(FireInitializeRow). But you shouldn't have to do that.
Problem seems that first I fetch for instance 50 records. InitializeRow is fired for these 50 records.
Then 50 new records are fetched, but records that come before the first 50 records. So in the bindingsource they come before the first 50.
Now it seems that the 50 first rows in the UltraGrid are used for the 50 new records, and 50 new rows are created for the 50 old records. And InitializeRow is fired again for the 50 old records, being 50 new rows.
Problem here is that background color of rows that was intended for the 50 first records is now applied to the 50 new records... Crazy...
The InitializeRow isn't fired for the 50 first records because according to the BindingSource nothing changed...
I'm kind off lost here. By the way, the binding source is a pro binding source from OpenEdge... Don't ask.