RadMaskedTextBox Behavior - Help

2 posts, 0 answers
  1. John
    John avatar
    22 posts
    Member since:
    Jan 2011

    Posted 12 Sep Link to this post

    Hello I am trying to have a RadMaskedTextBox allow the user to type an SSN, with the caveat that they must be allowed to hit spacebar (whitespace) or the prompt character X.  The idea is to  have a wildcard search.

    So I tried with the simple example:

    <telerik:RadMaskedTextBox ID="txtSearchSSN" DisplayMask="XXX-XX-XXXX" Mask="###-##-####" PromptChar="X" runat="server" />

    However this did *not* allow whitespace like the documentation suggested, and instead would fire a validator off in the control and disallow it.  So I rewrote it lengthier but more explicit so it will include a range from 0-9, X, or a whitespace, like this:

    <telerik:RadMaskedTextBox ID="txtSearchSSN" DisplayMask="XXX-XX-XXXX" Mask="<0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X>-<0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X>-<0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X>" PromptChar="X" AllowEmptyEnumerations="true" runat="server"  />

    Now it appears to validate and handle the way I would want, but now whenever I use spacebar (whitespace) to indicate a wildcard it changes the input value to Zero (0) rather than leaving it as the prompt character X.

    Am I missing something obvious with this control to do what I want?

    So if the user types 548 and then all X or Spaces, I want it to show in the input box as 548-XX-XXXX, but now it shows 548-00-0000 if I use spaces.  Using X as input has it showing properly though.

    Any help is appreciated

    Thanks!

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 15 Sep Link to this post

    Hi,

    I would suggest you to review the following forum post where a possible approach for the required functionality is suggested.
    Test it on your side and let me know if it helps.

    Regards,
    Maria Ilieva
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top