Hi Mike,
We have created a dataset with various tables and relations among them and wrapped the object in a BindingSource object before setting as data source of ultra grid object.
Now when we add new row to data tables at run time, InitializeRow gets called twice. Upon looking at call stack for both calls, I could distinguish that one call is raised through BindingSource.ListChanged event and another call is raised through DataView.OnListChanged event. Problem occurs when call through DataView brings in corroupted datarow associated with ultra grid row through ListObject property.
Can you please provide some help?
Is there any way that we can enforce InitializeRow should be called only once?
Thanks in advance
I'm afraid I don't understand the issue. What is this about corruption of the DataRow?
The InitializeRow event is not support to only fire once. It fires quite often, and your code should not make the assumption that it will fire only once. It fires the first time the row is created and any time a value in the row is changed and under several other circumstances, as well. This is the intended behavior.
You may want to check e.ReInitialize if there is some code that you only want to run the first time the row is initialized.
There is no reason why it shouldn't fire many times, infact firing that event would help you to get the latest data,info. available to the user. It is a property of the grid to fire those events for every change in the row.
In all cases, still if you don't wish to happen more than once, after initial firing set a flag and from then on check the flag, but it is not advisable.