RadNumericTextBox rounding

2 posts, 0 answers
  1. John
    John avatar
    6 posts
    Member since:
    Jun 2008

    Posted 26 Jun 2009 Link to this post

    I am using a RadNumericTextBox that needs to support up 5 digits before the decimal point and up to 15 digits (which i am planning on enforcing with an asp RegularExpressionValidator) after the decimal point (for example, 12345.123456789012345).  If I enter this number it gets rounded off to 12345.123456789011 when the control loses focus.

    If I enter 0.123456789012345 it stays as 0.123456789012345 when the control loses focus which is the desired behavior.

    This is the markup for the RadNumericTextBox

    <

     

    telerik:RadNumericTextBox ID="radTXTValue" runat="server" Width="500px"><NumberFormat DecimalDigits="15" AllowRounding="false" /></telerik:RadNumericTextBox>

     



    Any help in resolving this will be appreciated.

    John

  2. Dimo
    Admin
    Dimo avatar
    8457 posts

    Posted 30 Jun 2009 Link to this post

    Hi John,

    I am afraid that you have reached a limitation in the Javascript. Try this to see it:

    parseFloat("12345.123456789012345") // will return 12345.123456789011

    You can try using a different type of textbox (e.g. RadTextBox) and handle (validate, etc) the numbers with custom code client-side and/or server-side.

    Greetings,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top