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

RadMaskedTextBox Behavior - Help

1 Answer 111 Views
MaskedTextBox
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 12 Sep 2016, 03:20 PM

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!

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 15 Sep 2016, 01:12 PM
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.
Tags
MaskedTextBox
Asked by
Robert
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or