RadMaskedTextBox - more digits (17,2)

4 posts, 0 answers
  1. Mohan
    Mohan avatar
    17 posts
    Member since:
    Jun 2012

    Posted 09 Aug 2012 Link to this post

    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.
  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 14 Aug 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mohan
    Mohan avatar
    17 posts
    Member since:
    Jun 2012

    Posted 17 Aug 2012 Link to this post

    Thank you, let me try your solution approach.
  5. Mohan
    Mohan avatar
    17 posts
    Member since:
    Jun 2012

    Posted 17 Aug 2012 Link to this post

    I'm able to proceed thank you Kostadin.

    Thanks,
    Mohan.
Back to Top