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

RadMaskedTextBox - more digits (17,2)

3 Answers 56 Views
Input
This is a migrated thread and some comments may be shown as answers.
Mohan
Top achievements
Rank 1
Mohan asked on 09 Aug 2012, 05:28 PM
Hi,

We have a situation where we need to restrict user to input only numbers and the limit should be 15 digits with 2 precision.
We tried using the below code and looks there is a restriction of using more than 9 digits:

<telerik:RadMaskedTextBox ID="tbQuantity" runat="server" SelectionOnFocus="SelectAll"                                                                 AutoPostBack="true" Mask="<0..9999999999999>.<0..99>" />

We also tried the below from Telerik demos but the "." comes end like "111111." even though we type "111.111"
 <telerik:RadMaskedTextBox ID="txtNewPrice" runat="server" DisplayFormatPosition="Right" HideOnBlur="true" EmptyMessage="" Mask="##############.##" DisplayMask="##############.##" />

Please help in this regard. 

Thanks.

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 14 Aug 2012, 03:36 PM
Hello Mohan,

What you are trying to achieve cannot be done with RadMaskedTextBox, because you have to enter all 13 digits before enter the 2 digits after the separator. You can use RadNumericTextBox and set MaxLength property to 16 and NumberFormat-DecimalDigits property to 2. Note that in this case the decimal separator is count as part of the length. The best way would probably be to use a RegularExpressionValidator with RadTextBox. I have prepared and attached to this message a sample where you can see the differences between the three controls.

Kind regards,
Kostadin
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
Mohan
Top achievements
Rank 1
answered on 17 Aug 2012, 10:47 AM
Thank you, let me try your solution approach.
0
Mohan
Top achievements
Rank 1
answered on 17 Aug 2012, 01:31 PM
I'm able to proceed thank you Kostadin.

Thanks,
Mohan.
Tags
Input
Asked by
Mohan
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Mohan
Top achievements
Rank 1
Share this question
or