Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Null values for integers are not displayed properly by the Telerik NumericUpDown control

We are using the Telerik RadNumericUpDown control (2013 version) in our application to display & edit both double values and integers; The control works fine for nullable double types: it displays nothing for a null value, and 0.00 for the 0 value. We want the same behaviour for integers, but the control always displays 0 for null values. I've tried setting the NullValue to an empty string & null, based on the discussion here: http://www.telerik.com/community/forums/silverlight/numericupdown/null.aspx, but this doesn't solve our issue.

The XAML:

      <telerik:RadNumericUpDown Value="{Binding Path=Contents, Mode=TwoWay}"
                        NumberDecimalDigits="0"
                        IsEnabled="True"
                        IsEditable="True"
                        IsInteger="True"
                        NullValue=""                                
                        MinWidth="70"
                        HorizontalAlignment="Left"
                        HorizontalContentAlignment="Left" />

The Contents property is a nullable int.

Any help is appreciated.

like image 760
Cornel Marian Avatar asked Jan 13 '23 15:01

Cornel Marian


1 Answers

Try adding to the binding TargetNullValue='', worked for me

    <telerik:RadNumericUpDown Value="{Binding Path=Contents, Mode=TwoWay, TargetNullValue=''}" 
                    IsEnabled="True"
                    IsEditable="True"
                    IsInteger="True"
                    NullValue=""                                
                    MinWidth="70"
                    HorizontalAlignment="Left"
                    HorizontalContentAlignment="Left" />
like image 132
Lionely Avatar answered Jan 21 '23 02:01

Lionely