StrataFrame Forum

IsDirty

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

By Wil Cantrell - 12/5/2006

In a maintenance form, I have a method to check the IsDirty property of the business object and prompting the user to save changes if IsDirty is true.

If the BO is in edit mode and without making any edits to the bound fields, IsDirty is returning true when I close the form while in edit mode. Is this the desired behavior for IsDirty? Or should I look at another property or method to determine if changes have been made?

Thanks!!

By Greg McGuffey - 12/5/2006

There is a property for BOs in the Strataframe: Business Layer Settings called SetDirtyOnEdit. My guess is that if you set this to False, then it will only be marked dirty when an actual edit is made. (I haven't messed with it yet, so this is just a guess).
By Wil Cantrell - 12/5/2006

That's it. Setting SetDirtyOnEdit to false gave me the desired behavior. Thanks Greg!
By Trent L. Taylor - 12/5/2006

Keep in mind that you can have some side-effects from doing this though.  Your MaintenanceFormToolstrip will not properly reflect your edit mode since the EditingStateChanged event did not change.  Another option here is to turn off the auto-prompting:

MyForm.AutoShowSaveChangesMessage = False

This is another direction.  Just FYI Smile

By Wil Cantrell - 12/5/2006

I see now. Hehe But setting SetDirtyOnEdit back to true, my toolbar still doesn't get notification. After going into edit mode ALL the buttons disable. How do I get them back?
By Trent L. Taylor - 12/5/2006

If you click the Undo or Save the buttons should be reset if you are using the default IncludeInForm settings.  If you have modified the IncludeInForm settings to determine which BOs are navigated, edited, added, etc. then you can change the behavior of the MaintenanceFormToolstrip.
By Wil Cantrell - 12/5/2006

Once I click Edit, ALL the buttons are disabled including Save and Undo.Unsure
By Trent L. Taylor - 12/5/2006

It sounds like you have some of the IncludeInForm settings changed.  What are the settings of your IncludeInForm properties on the form and on the business objects?

By Wil Cantrell - 12/5/2006

D'oh. For some reason my IsDirtyOnExit changing back to true didn't take. I just wasted support points.Blush
By Greg McGuffey - 12/5/2006

I had a feeling this wasn't as simple as setting that one property Pinch
By Trent L. Taylor - 12/5/2006

No problem Wink .... the .NET environment can sometimes cause serialization frustrations (saving your property settings in the designer file).  Just make sure the right-click -> Reset takes effect by saving and getting out of the class and coming back in.
By Wil Cantrell - 12/5/2006

I noticed you used that reset option in class and resolved to get into that habit myself, but being a boolean field, I didn't stress over it. :p
By Trent L. Taylor - 12/5/2006

I understand Smile