MaskedTextInput -- can't insert

2 posts, 0 answers
  1. Trump
    Trump avatar
    48 posts
    Member since:
    Nov 2017

    Posted 24 Oct 2018 Link to this post

    I want to use MaskedTextInput to replace textbox with StringFormat, it is pretty simple.

    <telerik:RadMaskedTextInput Text="{Binding SSN, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" InputBehavior="Replace"  Mask="###-##-####" />

    I use it to display the SSN in the certain format when I get it from the service. Also I want to update it as well.

    At the beginning, it is empty. I tried to insert a random value. But I can only insert the first two number. Sometimes even I can't insert a letter. There is a red X on the right of the textbox, Not sure what is wrong.

    Thanks.

  2. Dinko
    Admin
    Dinko avatar
    1184 posts

    Posted 29 Oct 2018 Link to this post

    Hi Trump,

    Looking at the provided code snippet you have bound only the Text property, not the Value property. The Value property represents the user input without the formatting characters. The Text property will always retrieve the user's input formatted according to the Mask and the TextMode property. Also, the "#" means that the user restricted to enter only digit symbol. You can read more about the mask tokens in the Mask Tokens help article. If you want to allow typing letters and digits you can use "a" or "A" token. I have created a sample project to demonstrate this approach. Give it a try and let me know if it works for you.

    Regards,
    Dinko
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top