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

Bind to nullable values

3 Answers 96 Views
NumericBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anton
Top achievements
Rank 1
Anton asked on 18 Dec 2015, 05:12 PM

Hello. I tried to bind RadNumericBox to a nullable property and after that the control was not sending any value updates to the property. How could I fix it?

 

Thanks

3 Answers, 1 is accepted

Sort by
0
Anton
Top achievements
Rank 1
answered on 18 Dec 2015, 05:19 PM
Property type is short?/decimal?. Everything works fine when I replace these types to short/decimal or to double?.
0
Ivaylo Gergov
Telerik team
answered on 23 Dec 2015, 04:27 PM
Hi,

Thank you for your interest.

We will further investigate this issue and I will get back to you as soon as we have any information.

Regards,
Ivaylo Gergov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Ivaylo Gergov
Telerik team
answered on 28 Dec 2015, 08:39 AM
Hi,

The RadNumericBox.Value property is of type double? and while the framework can handle the conversion between double? and int for example(RadNumericBox by default handles the conversion between your data type to double?), this is not the case with decimal. In this case you will need a converter tho convert from double? to the desired type.
Here's an example:

public class CConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, string language)
    {
        return value;
    }
 
    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        var decimalValue = System.Convert.ToDecimal(value);
 
        return decimalValue;
    }
}

Let me know should you need further assistance.

Regards,
Ivaylo Gergov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
NumericBox
Asked by
Anton
Top achievements
Rank 1
Answers by
Anton
Top achievements
Rank 1
Ivaylo Gergov
Telerik team
Share this question
or