I've seen a few posts (i.e. http://forums.lhotka.net/forums/p/6514/31450.aspx#31450) in which issuing the CancelEdit on the root object does not remove newly created child objects. I have just encountered this situation and wondered if there was a solution.
CSLA version: 4.0.30319
In our scenario we have a root object (BO), containing a list of child objects (BLB and BO).
Our BLB contains an overridden AddNewCore() method:
Child _child = new Child();
We also use the RebindUI pattern as follows:
this.rootBindingSource.RaiseListChangedEvents = false;
this.childItemsBindingSource.RaiseListChangedEvents = false;
UnbindBindingSource(this.childItemsBindingSource, saveObject, false);
UnbindBindingSource(this.rootBindingSource, saveObject, true);
this.childItemsBindingSource.DataSource = this.rootBindingSource;
this.rootBindingSource.RaiseListChangedEvents = true ;
this.childItemsBindingSource.RaiseListChangedEvents = true ;
I can't see how/why the child is not removed. Any suggestions?
Found the problem (thanks to EL and the logging we have in place). The issue was in relation to adding the new object. The method removed the bindings when adding the new element. Once I removed this line, any additions to the grid were removed when the CancelEdit was called.
I am also facing the same problem.
Can u explain how & what exactly you have done to overcome this problem.
Thanks in Advance!
Copyright (c) Marimer LLC