Hello,
This is in connection with my earlier post on Adding a New Unbound Row to WinGrid. Please refer to my Post as well as reply for the background scenario.
Now, based on the description, the new order in my ultragrid is actually in 2 states.
1. Pending: Order placed, waiting for admin approval
2. Approved: Order approved.
Now, I need to color the orders pending approvals. Once the orders are approved, the row color is reset to the default ones. Currently I have reset the color of the rows as WHITE background with BLACK as text color. I can color the rows at perticular index in the grid. But when the grid is sorted or grouped, the color is not(as it is colored based on indexes).
Can anyone suggest how should it be done?
Thanks a lot!
Hm, I thought there was a ResetAppearance on the row. If not, then I'd recommend setting row.Appearance = null, rather than calling row.Appearance.Reset.
The former will clear the row.Appearance and the row will draw as normal.
The latter will reset all of the properties on the row's Appearance object. This is not good, because that appearance might be used by other objects and you don't necessarily want the other objects to have their appearances cleared.
You might also want to take a look at the WinGrid Performance Guide for some tips on how to do this most efficiently.
I don't see a row.ResetAppearance. However I do see Row.Appearance.Reset. This article helped me find the Row.Appearance.Reset. I think this is a typo, but if not Mike please let me know. I could not find ResetAppearance.
If changing a value in the data source is not firing the InitializeRow event of the grid, then your data source is not firing notifications when values change. This could be a bug in the data source or it could just be that you are using an IList data source. If that's the case, you can just call grid.Rows.Refresh(FireInitializeRow) when the value changes and this will force the grid to fire the event.
You might want to consider using a more robust data source that implements IBindingList, though.
Mike Saltzman"] Why? You really shouldn't care whether it's the first time or not. What you want to do is handle the event and examine the value in the cell or cells of the row and then either apply or reset the formatting accordingly. It does not matter if the row is being initialized the first time or the hundredth time.
Why? You really shouldn't care whether it's the first time or not. What you want to do is handle the event and examine the value in the cell or cells of the row and then either apply or reset the formatting accordingly. It does not matter if the row is being initialized the first time or the hundredth time.
Oh correct! I've tried this and it's working
But to reset the formatting. It's not firing the InitializeRow event once I update the datasource. I am not adding the new record to the datasource. I just update the datasource with the OrderID which I received in Order Confirmation message from the server. Before order is confirmed, this OrderID is 0
sagarbora said:Yes, I am checking whether the row is initialized for the first time or reinitialized.
sagarbora said:Can you please advice in which event I can reset the appearance of the perticular row? Is it InitializeRow again or some different one.
You only need InitializeRow and no other event.