RadNumericUpDown null for minimum

3 posts, 1 answers
  1. Lance
    Lance avatar
    34 posts
    Member since:
    Sep 2007

    Posted 24 Mar 2010 Link to this post

    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. Answer
    Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 25 Mar 2010 Link to this post

    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.
  3. DevCraft banner
  4. Lance
    Lance avatar
    34 posts
    Member since:
    Sep 2007

    Posted 25 Mar 2010 Link to this post

    Thanks Boyan,

    This works perfectly apart from the bug you described.
Back to Top