Issue with Numeric TextBox

4 posts, 0 answers
  1. Dorababu
    Dorababu avatar
    95 posts
    Member since:
    May 2012

    Posted 03 Oct 2012 Link to this post

    Hi all when I enter values as follows 1234567891234567891 in Numeric Textbox I am getting some thing like as follows when I leave the textbox 70368744177664 what should I do in-order to accepts a long digit in Numeric Textbox.

    Also when I enter some thing like 1222 it is displaying as 1,222.00 what should I do in-order to display as it is as the entered value
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Oct 2012 Link to this post

    Hi Dorababu,

    You can set Maxvalue property of RadNumericTextbox to accept long digits.But RadNumericTextxbox control does not support maximum or minimum value more/less than +/- 2^46. Setting the Maxvalue property  more than 2^46 may cause abnormalities in the behavior. You can use the RadTextBox control with RegExp to accept values greater than 2^46. Try the following code to avoid rounding and grouping in RadNumericTextbox.

    ASPX:
    <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" MaxValue="12345678912345678" AllowOutOfRangeAutoCorrect="false" >
      <NumberFormat AllowRounding="false" GroupSeparator="" />
    </telerik:RadNumericTextBox>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dorababu
    Dorababu avatar
    95 posts
    Member since:
    May 2012

    Posted 04 Oct 2012 Link to this post

    I can't fix max value as per given why because user can enter any with a max length of 19..
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Oct 2012 Link to this post

    Hi DoraBabu,

    Try the following code to achieve your scenario.

    ASPX:
    <telerik:RadTextBox ClientEvents-OnKeyPress="OnKeyPress" ID="RadTextBox1" runat="server"></telerik:RadTextBox>

    JS:
    <script type="text/javascript">
        function OnKeyPress(sender, args)
        {
            var reg = new RegExp("[0-9]{1}");
            var pressed = args.get_keyCharacter();
            var key = args._keyCode;
            if (((36 < key) && (40 > key)) || (key == 8) || (key == 46))
            {
                return;
            }
            if (!pressed.match(reg))
            {
                args.set_cancel(true);
            }
        }
    </script>

    Hope this helps.

    Thanks,
    Princy.
Back to Top