Windows Forms UI Binding Question

Windows Forms UI Binding Question

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


Joffies posted on Tuesday, April 22, 2008

Hi Folks

I am trying out the Windows Forms binding on a CSLA business object. I have bindingsource component linked to my custom business object called Role.

I have two text boxes on the form one for the Role Name and the other for the description.

When I change the value within any of the textboxes and clicking straight on the save button the change is ignored and the value reverts back to the previous value.

Only when I tab out after changing and the clicking the save button does it save correctly. I am new to CSLA so I might be missing something simple here which I am sure is the case.

Thanks for you input and advice.

 

Marjon1 replied on Tuesday, April 22, 2008

This is an issue with your databindings not firing that the value has changed until validation. You need to change the bindings to update on PropertyChanged instead of Validation. This can be done via the UI by going to the advanced properites of your databindings on the text boxes.

When you click save it's performing the save (without changes) and then returning the old object which the binding source detects and refreshes all the alues.

Marjon

Joffies replied on Tuesday, April 22, 2008

Thanks Marjon, it works a treat!

JonnyBee replied on Sunday, April 27, 2008

You may also check if your buttons (and UI controls) has "CausesValidation" set to True. The validation event in your textbox is triggered by focusing another UI control in your form that has Causesvalitation set to true.

jonny

Copyright (c) Marimer LLC