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

ValueChanging and DecimalDigits zero

4 Answers 52 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Fabio
Top achievements
Rank 1
Fabio asked on 07 Jul 2016, 05:36 PM

Hi

I think that I found a bug.

Take a radnumeric, set decimaldigits zero.

use client event valuechanging like this:

                function valueChanging(sender, args) {
                    alert(args.get_newValue());
                }

If I digit "0,4" I'm expecting in the args.get_newValue() just 0 and not 0.4!

I think that the "." or "," (depends on cultureinfo, ok) not even should be arrived to the input, just like any alphanumeric character that is not a number!

Why you allow decimal digit in that event if I set decimaldigits zero? I don't want to use valueChanged.

Just.. I think that the radnumeric settings should be considered before any event.

All of this is on last ui for ajax version 2016.2.607.45

Thank you.

Regards

Fabio

4 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 12 Jul 2016, 08:13 AM
Hello Fabio,

The ValueChanging event is fired before the value in the RadNumericTextBox is changed. This is why you are seeing the decimal digits when you alert the value there. If you would like to see the final value that would be used by the numeric input you should use the ValueChanged event.


Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Fabio
Top achievements
Rank 1
answered on 12 Jul 2016, 08:21 AM

Hi Viktor

 

thank you for your reply.

I know that. Just I think, even in the valuechanging, value inserted should depends on the setting

<NumberFormat DecimalDigits="0" />

this settings come before any event. args.get_newValue() should be without any decimal digits imho.

Btw know that I solved truncating decimal part (this is my requirement) in the js event.

Just this post is on to let you know my thought about this behaviour.

Thank you again.

Bye

Fabio

 

0
Viktor Tachev
Telerik team
answered on 14 Jul 2016, 12:57 PM
Hello Fabio,

I understand your point, however there is complex internal logic implemented by the control that is intended to use in vast number of scenarios. This is why the ValueChanging is raised before the value for the NumericTextBox is set.

Moreover, this way you can perform additional logic, using the value entered by the user before it is set for the input.

Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Fabio
Top achievements
Rank 1
answered on 14 Jul 2016, 01:41 PM

Hi Viktor

That's ok. Even if I think that OnKeyPress should be used to achieve what the user digits.

onValueChanging give me values (old and new) which are not (and should be) compliant with the settings I gave.

Call that a feature if you want, as I said... it's ok.

Regards

Fabio

Tags
NumericTextBox
Asked by
Fabio
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Fabio
Top achievements
Rank 1
Share this question
or