ValueChanging and DecimalDigits zero

5 posts, 0 answers
  1. Fabio
    Fabio avatar
    8 posts
    Member since:
    Sep 2013

    Posted 07 Jul Link to this post

    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

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 12 Jul Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Fabio
    Fabio avatar
    8 posts
    Member since:
    Sep 2013

    Posted 12 Jul in reply to Viktor Tachev Link to this post

    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

     

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 14 Jul Link to this post

    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.
  6. Fabio
    Fabio avatar
    8 posts
    Member since:
    Sep 2013

    Posted 14 Jul in reply to Viktor Tachev Link to this post

    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

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017