RadMaskedEditBox - standard maskType, Mask = "aaaaa", unexpected behavior

4 posts, 0 answers
  1. Catalin
    Catalin avatar
    18 posts
    Member since:
    Jun 2008

    Posted 29 Nov 2013 Link to this post

    Hi all,

    I’m trying to simulate the MaxLength property (which is no longer available) on a RadMaskEditBox and I use:
    radMaskedEditBox1.MaskType = MaskType.Standard; 
    radMaskedEditBox1.Mask = “aaaaa”;

    I set programmatically a first value in my RadMaskedEditBox1, “ABCDE”. The displayed value on my control is, as expected, “ABCDE”. 

    Then I try to set another value, "XX”, and I notice that de displayed value of the control is “XXCDE”.

    Any idea? How can I use masks to limit the chars n° in the RadMaskEditBox?
    Thank you


    L.E.: RadControls version 2013.3.1127.40
  2. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 03 Dec 2013 Link to this post

    Hi Catalin,

    Thank you for writing.

    When you have initialized the mask like this you cannot enter more than five letters (your length is limited to 5 letters). Then also when you are setting the text like this it will only change the first two letters. To clear the remaining letters you can either clear the entire box or to set some spaces after the desired text:
    radMaskedEditBox1.Text = new string(' ', radMaskedEditBox1.Text.Length);
    radMaskedEditBox1.Text = "XX   ";

    I hope this will be useful. Should you have further questions, I would be glad to help.

    Regards,
    Dimitar
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Catalin
    Catalin avatar
    18 posts
    Member since:
    Jun 2008

    Posted 04 Dec 2013 Link to this post

    Thank You, Dimitar, 

    This might be a solution, but I think the mask "aaaaa" means "5 alphanumeric optional char".
    Adding some trailing characters just to erase the MaskedEditBox's content it's not coherent...

    Thanks again, I'll try to use your solution.

    Best regards,
    Catalin
  5. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 09 Dec 2013 Link to this post

    Hi Catalin,

    Thank you for writing back.

    This is how RadMaskedEditBox is working (every character is validated or changed separately) and this is the default behavior by design. 

    Do not hesitate to contact us if you have other questions.

    Regards,
    Dimitar
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top