StrataFrame Forum

Is there any plan to support bindding to the IsDirty Property of a business object?

http://forum.strataframe.net/Topic8318.aspx

By Jerome Barnett - 4/19/2007

Currently I have a Save and a Cancel button on my main form. I change there enabled state in the myBO.EditingStateChanged and BO_FieldPropertyChanged events

mybutton.Enabled = myBO.IsDirty

but I would rather databind to the IsDirty property so that I don't have to needlessly piggyback off of two other events.



Any ideas on how to accomplish this?



Thanks



Jerome
By Trent L. Taylor - 4/19/2007

The IsDirty property really does nothing more than enumerate through the internal data table to see if there are any dirty records.  Really all you have to do is set the BusinessObject property of the button and leave the BindingField empty.  This should manage the editing state of the button without any code at all.
By Jerome Barnett - 4/20/2007

I think I might not have been clear. My objective is to have the buttons only available if the BO is Dirty not when it is just in edit mode.



I have SetDirtyOnEdit set to false. Just wondering what the best/recommended way to Enable/Disable buttons based on whether a BO has been modified is.

If there is not other way I will proceed as I have already, but I'd like to know if I am overlooking a better way.



Thanks



Jerome
By StrataFrame Team - 4/23/2007

In order for .NET data binding to bind to a property, the property must support changed events.  The business objects do not have an IsDirtyChanged event to go along with the IsDirty property because the IsDirty property is not stored in a value within the business object... it is determined by doing a Select() of the RowState of the rows within the business object when the Get of the IsDirty property is called.  If you don't want to piggy back off of those 2 events, you can either dynamically add a handler to the BO.CurrentView.ListChanged event or drop a BusinessBindingSource on the form and set its business object to your business object and bind to its ListChanged event.  That event will get fired whenever any data within the internal table is changed.
By Jerome Barnett - 4/23/2007

Thanks for the reply...I think I'll leave it the way I have it setup now....I just wanted to make sure I wasn't missing out on a more elegant solution.



Jerome