CancelEdit problem - New Child not removed

CancelEdit problem - New Child not removed

Old forum URL:

Phlar posted on Friday, November 05, 2010

Hi All,

I've seen a few posts (i.e. 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;


if (rebind)


 this.rootBindingSource.RaiseListChangedEvents = true ;

 this.childItemsBindingSource.RaiseListChangedEvents = true ;

 if (rebind)





I can't see how/why the child is not removed.  Any suggestions?

Phlar replied on Friday, November 05, 2010

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.

Kalpesh Shah replied on Wednesday, January 11, 2012

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