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


Author
Message
Jerome Barnett
Jerome Barnett
StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)
Group: Forum Members
Posts: 10, Visits: 65
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
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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.
Jerome Barnett
Jerome Barnett
StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)
Group: Forum Members
Posts: 10, Visits: 65
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
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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.
Jerome Barnett
Jerome Barnett
StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)
Group: Forum Members
Posts: 10, Visits: 65
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
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search