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

Copy-Paste in RadNumericTextBox Seems to Work Incorrectly

5 Answers 129 Views
Input
This is a migrated thread and some comments may be shown as answers.
ryanderso
Top achievements
Rank 1
ryanderso asked on 29 Aug 2008, 10:34 PM
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

5 Answers, 1 is accepted

Sort by
0
plamen
Top achievements
Rank 1
answered on 01 Sep 2008, 09:07 AM
hi

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


Hope this helps...
<John:Peel />
0
ryanderso
Top achievements
Rank 1
answered on 10 Sep 2008, 06:54 PM
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
0
Yavor
Telerik team
answered on 11 Sep 2008, 05:20 AM
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.
0
Prashant
Top achievements
Rank 1
answered on 09 Apr 2013, 01:18 AM
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
0
Vasil
Telerik team
answered on 11 Apr 2013, 01:39 PM
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.
Tags
Input
Asked by
ryanderso
Top achievements
Rank 1
Answers by
plamen
Top achievements
Rank 1
ryanderso
Top achievements
Rank 1
Yavor
Telerik team
Prashant
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or