This is a migrated thread and some comments may be shown as answers.

Unexpected MaskEdit Value Behavior

1 Answer 55 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Jerel
Top achievements
Rank 2
Jerel asked on 19 Mar 2009, 03:24 PM
Using the latest MaskedEdit control I am attempting to bind the control to a BindingSource using a List of a CustomObjects, similar to...

List<Agency> agencies = GetAgencies();
agencyBindingSource.DataSource = agencies;

Within the Agency object there is a propery called ZipCode, which I am feeding to the MaskedEdit Value propery via DataBinding

this.zipCodeMasked.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.agencyBindingSource, "ZipCode", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));

I also have a navigation control on the form that allows me to move through out the list and rebinds the controls to the Current object on the list. The strange behavior occurs when moving from one object that has a zipcode to another object that doesn't. When the first object has a ZipCode it appears within the control, however when moving to the next item that doesn't have a ZipCode, the control does not clear. Instead the next item appears to have the same ZipCode as the previous item.

I have use the following rework around...

 

 

var 

 

agencyValues = (Agency)agencyBindingSource.Current;

 

 

 

if (agencyValues != null && !agencyValues.Zip.IsNotNullOrEmpty())

 

 

{

    zipCodeMasked.Value =

null;

 

 

}

 

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 20 Mar 2009, 12:09 PM
Hello Jerel,

Thank you very much about the given feedback. I have to agree that this is a little strange behavior. Well I think that when you set the Value of the control to null when the ZipCode field is empty everything should work ok. I have updated your Telerik points.

Kind regards,
Boyko Markov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
MaskedEditBox
Asked by
Jerel
Top achievements
Rank 2
Answers by
Boyko Markov
Telerik team
Share this question
or