Print Page | Close Window

Control setters are being called too many times.

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=702
Printed Date: 27-Mar-2025 at 8:14pm


Topic: Control setters are being called too many times.
Posted By: fastianumair
Subject: Control setters are being called too many times.
Date Posted: 27-Feb-2008 at 7:00am
Hi.
 
When I change some text in a textbox, the setter of datamember fields of other controls on the same form are being called so many times. Sometimes 2, 3 or 4 times. I tried to trace and concluded that if the property changes, so the datasource changes. It binds the controls of the form again. But if it is so, then it should bind all the controls only once, at most. Why does it call the setter of datamember field of all the controls on the form; so many times?
 
How can this be prevented?
 
 
Additional Information:
 
Using control library, Infragistic.
 
Thanks.
 
Regards,
 
Umair.



Replies:
Posted By: davidklitzke
Date Posted: 27-Feb-2008 at 9:16am
As I understand, this is a characteristic of UI binding, and is not specific to DevForce.  If you can show us that DevForce behaves worse than native .NET binding, we will be happy to look at it.


Posted By: banzaii
Date Posted: 28-Feb-2008 at 9:54am

Hi, David!

Can you ensure me the behavior...

Behaviour

MyModelEntity has 5 Properties..

5 Different Controls are bind to that Entity. The controls use ControlDataBinder, UltraComboEditorDataBinder.

As soon as my Property 'A' changes, the Setter of the Value property of respectedly bind control get a call, fine.
But!!! all other control's "Setter" of "Value" property get a call too even though their Property isn't changed.
 
I check/uncheck a bool property, it fires the Value Setters of Combo, Textbox, Checkbox, and etc.

controlBindingDescriptor.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;

Is it because of this PropertyChanged? Still, can there be a check of Property? (Fire the setter of the control that is bind to the currently changed property only. And not the controls, of either the same type or different, with different properties).

Ideablade 3.6.0.2
 
Thanks and Regards.
HumaiR Bhagat.


Posted By: davidklitzke
Date Posted: 03-Mar-2008 at 11:22am
I don't know if this behavior can be changed.  In some cases, setting a property on one field may change the propery of another field.  For example, changing "BirthDate" will also change "Age".


Posted By: banzaii
Date Posted: 05-Mar-2008 at 10:27pm
Originally posted by davidklitzke

I don't know if this behavior can be changed.  In some cases, setting a property on one field may change the propery of another field.  For example, changing "BirthDate" will also change "Age".
 
No! the properties are not related to each other...
Infact, It goes to the value setter of each control that is bind on that view.
 
for e.g. my Amount doesnot have any relation with what is the Father Name of the entity, still It will go to the value setter of the FatherName control.
 
One thing I would like to clear, It doesNOT go the Business Model for re-setting properties, It ONLY goes to the Control's Value setter, may be this is some behaviour used for refreshing controls.
 
But if this can be done on related properties/controls only?


Posted By: davidklitzke
Date Posted: 07-Mar-2008 at 9:33am

I think the important thing to understand here is that this behavior is just the way that binding works in WinForms.  It is not something that DevForce can change,




Print Page | Close Window