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

RadMaskedTextBox

2 Answers 60 Views
Input
This is a migrated thread and some comments may be shown as answers.
Elisabeth
Top achievements
Rank 1
Elisabeth asked on 20 Dec 2012, 08:54 PM
I'm trying to use the RadMaskedTextBox. What I need to do is to allow the user to enter 3 different formats.

Below are examples

123

123-456

123-456-789


If he enters 132 then there is nothing different but if he types in 1234 then as soon as he enters 4, I need to display the dash. It is the same for 7. I can't use a validator as I need it on the entry and not when he is validating the page.

I thought about using a mask but I don't want to display the dash when the page loads in case he only types in 3 digits. I thought about a regular expression but I don't know how to implement only when the user is typing and not validating.

Maybe the RadMaskedTextBox is not the right control to use.

Thank you for your help.

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 25 Dec 2012, 10:28 AM
Hello Elisabeth,

I am afraid this functionality is not provided out-of-box. You will need to use the client events of the input to implement your logic ( OnValueChanged event for instance ).

I hope this helps.

Greetings,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Elisabeth
Top achievements
Rank 1
answered on 08 Jan 2013, 02:42 PM
Hi Eyup,

thanks for your reply.

I ended up using OnKeyPress and OnValueChanged and it works fine.

Regards.
Tags
Input
Asked by
Elisabeth
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Elisabeth
Top achievements
Rank 1
Share this question
or