Unexpected MaskEdit Value Behavior

2 posts, 0 answers
  1. Jerel
    Jerel avatar
    7 posts
    Member since:
    Feb 2009

    Posted 19 Mar 2009 Link to this post

    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;

     

     

    }

     

     

     

     

     

     

     

  2. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 20 Mar 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top