Hi,
OnListChanged(ListChangedType.ItemAdded, TargetCount-1);
We do see the new row in the grid. The problem is that we would like to perform some actions when adding a new row to the grid and AfterRowInsert is does not seem to be working.
What have we missed?
As always, thank you in advance.Annie
Are you adding a row to the grid? Or adding a row to the grid's data source?
I expect that the event only fires when you add a row through the grid and not when you add a row to the data source.
Hi Mike,
Well i m also facing the same prob but my scenario is different. I have constructed my own custom control inherited from UltraGrid, now i am placing my Custom grid on different form, but their is a common functionality i want to achieve on all the forms, after new row insert in the grid. I have register this event _AfterRowInsert but i didn't fire. Can you please describe why it is not firing?
Thank You
Hi Annie,
As I said, I think this is probably intentional. Your data source already fires an event for this and since it does, there's no reason for the grid to duplicate the event.
You might try the PropertyChanged event of the grid and see if that fires, but I suspect it won't.
Hello Mike,
In my specific scenario, I am counting on the grid receiving the notification that a row was added.
So if you have any clues as to why the event is not firing, please let me know and I will investigate. I would like to avoid using the workarounds you provided if possible.
Many thanks,
Annie
This is correct. AfterRowInsert fires to let you know when the user has added a new row. If you are adding the new row in code or if it is occurring as the result of some other action, then you already have a way of determing that it happened, and you don't need a grid event to tell you so.
You should probably trap the ListChanged event of your data source and use that. Or perhaps expose another event on your data source to indicate after the row has been added.