Copy-Paste in RadNumericTextBox Seems to Work Incorrectly

6 posts, 0 answers
  1. ryanderso
    ryanderso avatar
    19 posts
    Member since:
    Mar 2007

    Posted 29 Aug 2008 Link to this post

    Hi all -

    I am having an issue with the RadNumericTextBox that hopefully someone knows the solution to.  If I have the Input set to numeric and I copy-paste "$12.53" (or any other currency value), the result is that the value in the input ends up as "0.12" (or 0.[first two digits]).  It seems like, instead, the input box should be ignoring all characters other than acceptable numeric values.  This can be duplicated in the online example.  Anyone have any idea how to resolve this?

    Thanks,
    Ryan
  2. John
    John avatar
    416 posts
    Member since:
    Oct 2006

    Posted 01 Sep 2008 Link to this post

    hi

    You have to remove the currency symbol "$12.53" - > "12.53"


    Hope this helps...
    <John:Peel />
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ryanderso
    ryanderso avatar
    19 posts
    Member since:
    Mar 2007

    Posted 10 Sep 2008 Link to this post

    I realize that, but I have users that are used to being able to just copy-paste from a spreadsheet, and it seems like being able to ignore the "$" should be something that the control should do.  The ideal situation would be that the control ignore every character that is non-numeric - so, if I were to paste in "abd$12.52" the result would be "12.52".  Is there a modification that I can do to one of the javascripts that would permit this sort of functionality?

    Ryan
  5. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 11 Sep 2008 Link to this post

    Hello ryanderso,

    While bringing this functionality to the control by default is not planned, since this would potentially allow non-numeric input in a numeric control, you can attach to the onValueChanged client side handler, and restore the value to 12.53. I hope this is a suitable option for you.

    Best wishes,
    Yavor
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Prashant
    Prashant avatar
    1 posts
    Member since:
    Jan 2013

    Posted 08 Apr 2013 Link to this post

    Hi Telerik,

    Is there a way to diable this functionality altogether, on the text box, when user paste a AlphaNueric string, I want to set the control value to '0' zero instead of only the filtered numeric value. i.e lets say if I paste ABS1245.4543 I want the paste operation to result in 0 'zero' being shown in text field instead of '1245.4543' which RadNumericTextbox would do by default.

    Kind regards,
    Prashant
  7. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 11 Apr 2013 Link to this post

    Hi Prashant,

    You can parse the text manually on valueChanging event and set different value than internally parsed. Here is some example:
    <script type="text/javascript">
     
        function valueChanging(sender, args)
        {
            if (parseFloat(sender.get_element()).toString() == "NaN")
            {
                args.set_newValue(0);
            }
        }
     
    </script>
    <telerik:RadNumericTextBox runat="server" ClientEvents-OnValueChanging="valueChanging">
    </telerik:RadNumericTextBox>


    Greetings,
    Vasil
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017