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

Saving the format of the value in a masked control

1 Answer 65 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Babak
Top achievements
Rank 1
Babak asked on 29 Apr 2014, 04:49 PM
I am using Silverlight and RadMaskedInputText but I think this can be a more general question:Let's say I have a control that accepts masked input like
 ###-###-#### and I enter 710- -9830
For some reason when I save the value into the database it is saved as 7109830
so next time that the form loads the mask will show 710-980-3 which is wrong.
What do you think is the root cause of the issue and how can I fix it?

<Setter Property="Mask" Value="###-###-####"></Setter>
<Setter Property="Placeholder" Value=" " />

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 30 Apr 2014, 04:18 PM
Hello Babak,

Note that this behavior is expected because the Value property of the masked input controls holds only the value and excludes the mask symbols. In order to save the value with the mask characters of the input control you can save also the Text property of the RadMaskedInputText. This property holds the value and the mask symbols which was used in the input. You can also take a look at the Data binding with RadMaskedTextInput forum which addresses an issue similar to yours. Basically you can bind the Value one way, this will get the string from the DB and then bind the Text OneWayToSource, this will always preserve the value with the mask symbols.

Regards,
Martin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Babak
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or