Delete + IsDirty - RemoveItem, Order of Operations Problem

Delete + IsDirty - RemoveItem, Order of Operations Problem

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


lacota posted on Friday, September 21, 2007

Hello

I am using v2.1.4 of csla. I have a collection derived from businesslistbase bound to a grid on a form. The form has a save button that is disabled until the following conditions are met (IsValid and IsDirty). When the user deletes an item from the grid the listchanged and removingitem events are raised. Unfortunately the events are raised before the item is placed in the Deleted List (See csla code below)   

 protected override void RemoveItem(int index)
    {
      // when an object is 'removed' it is really
      // being deleted, so do the deletion work
      C child = this[index];
      base.RemoveItem(index);
      CopyToDeletedList(child);
    }

As a result, if I put my code to enable or disable buttons in either of the above events, the IsDirty flag will still be false when checked.

Is this a bug or a feature? Is there a more elegant workaround than placing a call to check the business object state in all my button click event handlers?

Thanks

 

 

RockfordLhotka replied on Friday, September 21, 2007

Yes, this is fixed in 3.0.1 or 3.0.2.

Copyright (c) Marimer LLC