Using RADNumericUpDown

10 posts, 0 answers
  1. Ivan
    Ivan avatar
    7 posts
    Member since:
    Nov 2008

    Posted 06 Feb 2009 Link to this post

    Hello everybody!
    My radnumericcontrols have a strange behaviour . For example : if i insert the value 20, when the control lost focus, the value is set to 200%, wich isn't the correct value, at least the value I want. There is another issue here . What is the default decimal separator ?If I try to use the normal "comma", nothing happens . If I insert the value "10,23", the control doesn't accept my comma , so, instead of having the value "10.23", I get the value 1023 .

    Any suggestions ?
    Ivan Frias
  2. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 09 Feb 2009 Link to this post

    Hi Ivan,

    About your first question - this is actually the intended behavior of the control. We tried to replicate the Excel's behavior. If you open Microsoft Excel and set formation of a cell to be percentage you will see that it behaves exactly the same way - if you enter 3, the value will become 300%. This is because some programs need this behavior and use it.

    To accomplish the behavior you desire you can use the NumericUnit property and set it to "%" .  The default separator is not a comma but dot. If you want to change it you can use this line of code:

    numeric.NumberFormatInfo.NumberDecimalSeparator = "," ;

    This will overwrite only the visual look, however, you will still have to use numpad's dot to put the separator.


    Best wishes,
    Boyan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dogu Tumerdem
    Dogu Tumerdem avatar
    39 posts
    Member since:
    Sep 2006

    Posted 10 Feb 2009 Link to this post

    With all of my respect, but why I can use only numpad decimal separator ? why I cannot use , or . keys on the keyboard ? - most of our users are using notebooks and difficult to press numpad decimal separator.

    dogu
  5. Hristo Borisov
    Admin
    Hristo Borisov avatar
    298 posts

    Posted 10 Feb 2009 Link to this post

    Hello Dogu,

    The problem with the decimal point comes from the Silverlight framework itself. In case you are using a laptop and press the decimal point key you will get an Unknown key as an argument in the KeyDown event handler. We have find a workaround to this problem using the virtual-key codes table. Unfortunately, we have resolved the problem in case your operating system is Windows, because the virtual-key codes depends on the operating system itself. If you are using MAC OC X, you should wait a little bit to get the things in the right way. In case you need that functionality really urgent, we can provide you with an internal built that will resolve the problem until our official release is out later this month.


    Regards,
    Hristo Borisov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Dogu Tumerdem
    Dogu Tumerdem avatar
    39 posts
    Member since:
    Sep 2006

    Posted 10 Feb 2009 Link to this post

    that is not an urgent I can wait for your next release. Thank you for your assitance.

    dogu.
  7. Ercument Berktas
    Ercument Berktas avatar
    5 posts
    Member since:
    May 2008

    Posted 13 Mar 2009 Link to this post

    dear Hristo Borisov,

    I recently downloaded 2009/1 but this problem is not fixed, and it is not working properly. What can we do about it ?

    dogu tumerdem
  8. Hristo Borisov
    Admin
    Hristo Borisov avatar
    298 posts

    Posted 15 Mar 2009 Link to this post

    Hello Ercument Berktas,

    That is quite strange because I have tested the problem using my Dell vostro 1500. Moreover, if I go to the Silverlight demo website and I try to input decimal point using the laptop keyboard it doesn't seem to have any problems with it. What I can ask you is to create a simple textbox and wire up to the KeyDown event, and check the PlatformKeyCode of the KeyEventArgs. What you should get is PlatformKeyCode = 0xBE or 190 in integer. As its specified in the Virtual-Key codes by Microsoft this is the keycode of the decimal point in any Windows operating system here. If your keyboard returns different PlatformKeyCode then the one I mentioned, you are having some troubles with the layout of your keyboard. Get back to me as soon as possible so we can investigate this problem further, in case you are having really though time making it work, you can write me at hristo.borisov at telerik.com, so we can fix it, and post the solution here so everybody can access it.

    Regards,
    Hristo Borisov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. alex alex
    alex alex avatar
    2 posts
    Member since:
    Nov 2009

    Posted 03 Nov 2009 Link to this post

    con esto corrigen el problemas de los decimales.

    COORDENADAS_X.NumberFormatInfo.NumberDecimalDigits = 6;

    COORDENADAS_X=es el nombre del control
    NumberFormatInfo=referencia a la cultura
    NumberDecimalDigits=para que acepte los numero decimales
    6= la cantidad de decimales que quieres que aceptes

  10. Valentin
    Valentin avatar
    73 posts
    Member since:
    Mar 2016

    Posted 18 May in reply to Boyan Link to this post

    Hello Boyan,

    I want to know if is it possible to do that RadNumericUpDown accepts dot AND comma ?

    I see this code on the web :

    if (e.KeyChar.Equals('.') || e.KeyChar.Equals(','))
    {
        e.KeyChar = ((System.Globalization.CultureInfo)System.Globalization.CultureInfo.CurrentCulture).NumberFormat.NumberDecimalSeparator.ToCharArray()[0];
    }

     

    With this code, i did it :

    private void tbOpeSurValeur_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key.Equals('.') || e.Key.Equals(','))
        {
            e.Key = (Key)((System.Globalization.CultureInfo)System.Globalization.CultureInfo.CurrentCulture).NumberFormat.NumberDecimalSeparator.ToCharArray()[0];
        }
    }

    But :

    - I havn't got '.KeyChar' => I put 'Key'

    - 'e.Key' is in ReadOnly, i can't change his value..

     

    Can you help me ?

    Thank you.

     

    Valentin.

  11. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 20 May Link to this post

    Hello Valentin,

    I have replied in the other forum regarding the same question. You can see the reply at the following link:
    http://www.telerik.com/forums/radnumericupdown-acepts-comma-and-dot


    Regards,
    Yana
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WPF is Visual Studio 2017 Ready