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

NumericUpDown ValueChanged ContentText

7 Answers 204 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Jesper
Top achievements
Rank 2
Jesper asked on 09 Jul 2014, 09:59 AM
Hey,

I have a NumericUpDown control where Maximum value is set to 39 and Minimum value is set to -39. What im trying to achieve is to show a dialog window when a user has entered more than 39 as value or more than -39 as value and pressed "Enter", for example the value 89. I also have a ValueChanged event where when i debug it, i can see it has a Dependency property called ContentText which works fine for positive numbers but not for negative numbers. For example if i have entered 5555 the ContentText shows the number but if i have entered -5555 the ContentText shows -39 or any other negative number above -39 makes it go back to -39 where it should have shown the current value entered.

Is this a Telerik bug?.

Thanks.

7 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 10 Jul 2014, 12:13 PM
Hi Jesper,

Could you please give us some more details how to reproduce the issue. Because when Maximum and Minimum is set and the user tries to type in bigger/smaller number, the ValueChanged event is not fired, as the value is not changed.
If you could open a support ticket and send us a sample project and steps to reproduce the issue it will be of great help.

Looking forward to your reply.

Regards,
Konstantina
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Jesper
Top achievements
Rank 2
answered on 14 Jul 2014, 06:32 AM
Hey,

I have made a simple sample project. There is a Maximum value of 39 and a Minimum value of -39. 

Here is the link to the sample project: http://neets.dk/jml/RadNumericUpDownCustomSample.zip.

Steps to reproduce the bug:

1. Enter a positive value above 39 and press enter, for example 125.
2. Then the MessageBox dialog will show up correctly and tell that this number is out of range.
3. Now try and type another positive number, for example 532 and press enter.
4. Now the MessageBox dialog doesn't show even though the entered value is higher than 39. If we keep typing positive numbers and press enter, for example 542 and press enter and 532 and press enter the MessageBox dialog still doesn't show.
5. But if we then enter a negative number higher than -39 for example -64 then the MessageBox dialog will show up.
6. If we then enter a negative number again for example -94 and press enter the MessageBox dialog will now not show up again until i type a positive value.

Conclusion:

Its seems like it only fires ValueChanged when i enter a positive number and then a negative number or vice versa and so on.

Thanks.
0
Konstantina
Telerik team
answered on 14 Jul 2014, 11:16 AM
Hi Jesper,

The difference when I tested the described scenario was that I had the Value property bound with value set, so the first ValueChanged event was fired during loading.

Anyway, the described behavior is the expected one. Since at the beginning the value is not set, when you type in something the NumericUpDown sets the value to the Maximum (in case the input is greater). After that when typing in greater value the event is not fired as the value is not set, since the input is invalid. The ValueChanged event is fired again when a negative number is typed in, as this time the value is set to the Minimum. That is why when typing in positive and negative numbers one after another the ValueChanged event is fired as the value is set to the Minimum or Maximum.

Does this clears out the manner?

Regards,
Konstantina
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Jesper
Top achievements
Rank 2
answered on 14 Jul 2014, 11:35 AM
Hi Konstantina,

Yes, but is there a way to get the ValueChanged event to fire everytime? or is there another way to get the (invalid) value the user has typed?.
0
Konstantina
Telerik team
answered on 15 Jul 2014, 11:59 AM
Hi,

You could hook to the TextInput event which is fired on every key stroke. Then capture when the Enter key is hit and get the exact text at that moment.

Is that working for you?

Regards,
Konstantina
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Jesper
Top achievements
Rank 2
answered on 15 Jul 2014, 01:20 PM
Hi,

thanks, but unfortunately this doesn't work if you enter a value and click with the mouse outside of the RadNumericUpDown control so it loses focus. But thanks for your help, we will try to find another way to solve this. 
0
Konstantina
Telerik team
answered on 16 Jul 2014, 04:04 PM
OK, please let me know if I can be of further help.

Regards,
Konstantina
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
NumericUpDown
Asked by
Jesper
Top achievements
Rank 2
Answers by
Konstantina
Telerik team
Jesper
Top achievements
Rank 2
Share this question
or