ChildForm BO Becomes Dirty Even though I havent changed anything


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Jon, you may already know this, but just in case you don't and for those who may find this later...



Any time you have an unknow cause for a BO getting dirty, there is a handy event, the IsDirtyChanged event. Simply handle this event, set a break point in it, run code and then use the call stack to see were it is getting set dirty.



Glad you found your specific problem!
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Jon,

Glad you find the fix.  Now just to be clear, the StrataFlix approach of handling the data is not the same as the regular SF Maintenance Form would do, but it is a very good resource of seeing a different approach as one would call the standard/normal approach.

Edhy Rijo

Jon Neale
Jon Neale
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: Forum Members
Posts: 11, Visits: 93
I've managed to figure out part of it. The BO was being set to dirt as I had SetDirtyOnEdit = True on the BO. I'm not using a Maintenance Toolstrip so I think its ok to set this to false and everything seems to work ok now.

Thanks again

Jon

Jon Neale
Jon Neale
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: Forum Members
Posts: 11, Visits: 93
Hi

Thanks for your reply.

I have compared what i've done against the stratflix sample and cant see anything obvious. I think I have two different problems one is that for some reason the bo of the childform is dirty without me making any changes on the form. I have seen a thread about datepickers causing issues so maybe need to look at this a bit more.

The other is the cancel button. I thought, and from the look of the Strataflix sample, the cancel button just drops you back to the parent form ignoring if any changes have taken place. I cant seem to get it to do this.

This is what I have in the Cancel Button click event:

DialogResult = System.Windows.Forms.DialogResult.Cancel;

I am only a newbie, just trialing the product, so its not the end of the world just like to know what I'm doing wrong.

Thanks again for your feedback.

Jon

 


Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi John,

Please take a look at the StrataFlix sample application which make heavy use of the ListView and then you can compare with your code.

Basically it will depend on the code you have in the Cancel/Ok buttons and where are you actually saving/undo the data, it could be at the childform or parent form level.  Also at the form the is a property named AutoShowSaveChanges which controls if the message will be shown when saving, but in your case I am sure you don't want to auto save the record, so if that is the case post your code for the OK/Cancel button and also check the StrataFlix code it will reveal many things.

Edhy Rijo

Jon Neale
Jon Neale
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: Forum Members
Posts: 11, Visits: 93
Hi,

I've created a form with a ListView and associated a child form used the business object translations to map the parent BO to the child BO. So far I've only got the edit bit working but you can go in and change the details and it all works ok.

I have a couple of issues which I'm stuggling with a bit:

I've added an Ok and Cancel button onto the child form but when I click the cancel it still asks me to save the changes. Looking at this further it seems the child form bo is dirty before we make any changes on the form. What would be causing this? Am I going about this in the correct way?

Also when I go back to my Parent form one of the other BO's seems to have been cleared out? Any hints on what this could be?

Thanks

Jon

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