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

Using RADNumericUpDown

9 Answers 383 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 06 Feb 2009, 04:43 PM
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

9 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 09 Feb 2009, 04:21 PM
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.
0
Dogu
Top achievements
Rank 1
answered on 10 Feb 2009, 01:19 PM
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
0
Hristo Borisov
Telerik team
answered on 10 Feb 2009, 03:28 PM
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.
0
Dogu
Top achievements
Rank 1
answered on 10 Feb 2009, 03:33 PM
that is not an urgent I can wait for your next release. Thank you for your assitance.

dogu.
0
Ercument Berktas
Top achievements
Rank 1
answered on 13 Mar 2009, 08:24 AM
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
0
Hristo Borisov
Telerik team
answered on 15 Mar 2009, 12:56 PM
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.
0
alex alex
Top achievements
Rank 1
answered on 04 Nov 2009, 12:20 AM

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

0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 18 May 2016, 11:53 AM

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.

0
Yana
Telerik team
answered on 20 May 2016, 12:31 PM
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.
Tags
NumericUpDown
Asked by
Ivan
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Dogu
Top achievements
Rank 1
Hristo Borisov
Telerik team
Ercument Berktas
Top achievements
Rank 1
alex alex
Top achievements
Rank 1
Valentin
Top achievements
Rank 1
Iron
Iron
Yana
Telerik team
Share this question
or