EditLevel on databound object not decreasing

EditLevel on databound object not decreasing

Old forum URL: forums.lhotka.net/forums/t/4576.aspx


FrodeNilsen posted on Friday, March 28, 2008

I've read a couple of threads on undolevels on databound objects and lazy loading, so I realize this is sometimes a tricky area. Still, I have a situation here I cannot quite understand.

I have a TabControl with a lot of standard controls and UserControls on it. The Form with the TabControls has a lot of datasources (14) and the UserControls themselves have often several datasources on the same objects or children of these objects. Needless to say, this causes a headache when I need to know what datasources hold what business objects databound and / or in edit mode.

But look at this case. I have an object called NotatInfo which is a property of _avtaleInfo. _avtaleInfo is in turn a child (property) of the root object. I call EndEdit() on ALL 14 DataSource objects through the EndDatabindEdit() methods. The EditLevel on the NotatInfo object is then as expected 0 and BindingEdit is false. But look at what happens when I attempt an BeginEdit followed by CancelEdit! The EditLevel is upped to 1, does not go back to zero, but instead BindingEdit is suddenly true! What gives?

I know NotatInfo isn't bound anywhere else, but the parent and grandparent is/might be. Is this the problem? I did call EndEdit on the parent, so I don't quite understand why this should be a problem.

Any hints appreciated! Illustrating screenshots below.

Application sketch: http://i30.tinypic.com/330tgt0.gif

debug step 1: http://i27.tinypic.com/fntzp.gif

debug step 2: http://i31.tinypic.com/2qxay5v.gif

debug step 3: http://i30.tinypic.com/20ud7r8.gif

debug step 4: http://i26.tinypic.com/2qbertk.gif

 edit: I'm using CSLA v3.0.4

Copyright (c) Marimer LLC