Sunday, July 31, 2011

Data binding object does not update on Control EditValue Change

Here case is that a binding source have datasource as class object and the properties of that
object is binded with the winform controls. there datasource is not updating on the controls value
change.
Solution:
look into setting (DataBindings)\(Advanced)\Data Source Update Mode to OnPropertyChanged
in the properties for the binding. By default, this is set to OnValidation which means the data source
 is updated as part of the Windows Forms Control validation process when a control is exited
(or when you call EndEdit to force this to happen earlier). (For rows being newly added,
you will still need an EndEdit at some point to actually get the DataRow into the DataTable. 
But at least the in-memory data for the DataRow will be updated earlier.)
When you try to update the object then Validating event fire if it successes then the object update.
so select your update mode according to your requirment.

No comments :

Post a Comment