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

RadNumericUpDown null for minimum

2 Answers 177 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Lance
Top achievements
Rank 1
Lance asked on 25 Mar 2010, 03:11 AM
Hi,

I have a RadNumericUpDown which allows nulls.  I would like to have the down arrow treat null as the minimum after zero, so that if the value is zero and the down arrow is pressed, the value goes to null (after which the down arrow has no effect).  If the value is null and the up arrow is pressed then it goes to zero, then 1, 2,3, etc.  Can you please help me achieve this?  My RadNumericUpDown is configured as follows:

<

 

telerikInput:RadNumericUpDown Grid.Row="9" Grid.Column="3" x:Name="txtProduction" HorizontalAlignment="Left" Width="100" Height="20" Minimum="0" Maximum="9999999" NullValue="None" IsInteger="True" SmallChange="1" IsEditable="True" VerticalAlignment="Top" Margin="0,2,0,2" />

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Boyan
Telerik team
answered on 25 Mar 2010, 02:52 PM
Hello Tim English,

You can try to use the ValueChanged event and check if the new value is -1 and then set the Value to null. Note that you have to change the minimum to be -1. The code will look something like:
private void RadNumericUpDown_ValueChanged_1(object sender, RadRangeBaseValueChangedEventArgs e)
{
    if (e.NewValue == -1)
    {
        (sender as RadNumericUpDown).Value = null;
    }
}
However currently when the Value=null and press Up button the Value goes to 1 instead of 0 and this can't be handled with similar code like the one above. I have logged this as a bug ID 1549 in PITS, where you can follow its progress. With the fix and the above code you will be able to achieve your scenario.
Hope this is acceptable for you.


Greetings,
Boyan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lance
Top achievements
Rank 1
answered on 25 Mar 2010, 11:36 PM
Thanks Boyan,

This works perfectly apart from the bug you described.
Tags
NumericUpDown
Asked by
Lance
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Lance
Top achievements
Rank 1
Share this question
or