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

RadMaskedTextInput - Clearing the Editor

2 Answers 125 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Preston
Top achievements
Rank 1
Preston asked on 22 Jul 2012, 05:38 PM
Telerik Team,

I have the following RadMaksedTextInput setup:

<telerik:RadMaskedTextInput Mask="###-##-####"                                      
                   AllowInvalidValues="True"
                   Value="{Binding Value, Mode=TwoWay}"/>

This is bound to a nullable double that ultimately reflects a social security number, hence the associated format.  Once a number has been entered into the editor and then ultimately cleared (the entire value is highlighted and deleted or the last available value is deleted), the "Value" property, in which the control is bound to, is never updated.  It remains as the last non-null or not-empty value.  In this particular case, I would expect the property to be set to null.  How can I achieve this behavior?

Thanks in advance

PD

2 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 26 Jul 2012, 06:47 AM
Hi Preston,

 If I understand your scenario correctly, you are binding the masked text input (which value type is string) to a double value. This should throw some exceptions in the output about not being able to convert string to double. Perhaps, this is the reason why the value does not update. I would recommend using a IValueConverter with the binding between the editor and your value that would convert string to double and double to string. When the value is cleared, the result is an empty string and it cannot be properly converted to double (or nullable double).

Greetings,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Preston
Top achievements
Rank 1
answered on 30 Jul 2012, 08:55 PM
Alex,

You are absolutely right, a converter fixed the problem.  However, I still find it odd that the proper conversion is exhibited with any edits other than clearing the editor.  Nevertheless, my problem is solved.  Thanks for your timely response.

PD
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Preston
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Preston
Top achievements
Rank 1
Share this question
or