This is a migrated thread and some comments may be shown as answers.
Need to include the literals within the string of the RadMaskedTextInput
2 Answers 31 Views
This is a migrated thread and some comments may be shown as answers.
Rod
Top achievements
Rank 1
Rod asked on 03 Oct 2012, 04:17 PM
I'm working with the Telerik 2011 Q2 WPF controls (the last version we got, although we will be renewing our license soon).  I'm trying to put a control on the form for gathering the client's social security number.  Initially I used the RadMaskedNumericInput, because that's what I thought I should for SSN.  I now realize that was a mistake.  Now I believe I have to use the RadMaskedTextInput control.  I've tried a Mask value of "###-##-####" and now I'm trying "d3-d2-d4", but I don't know that it makes much difference.

What does make a big difference is what comes from the database (SQL Server 2005) and what goes back to the database.  As it turns out, all of the SSN in the database have the "-" between the first 3 digits and the second 2 digits, and between the second 2 digits and the third 4 digits.  Thus, if the client had a SSN of 555-12-1212, that is exactly what's stored in the database.  That's what's got to be displayed, that's what's got to go back.  And of course its stored as a VARCHAR(11) in the database.  But when the data gets fetched from the database, what gets displayed in the RadMaskedTextInput control looks like this (using the same ficticious SSN): "555--1-2___"

That's not going to work at all.  What am I doing wrong and how do I fix it?  Here's the XAML:
<telerik:RadMaskedTextInput Name="radSocialSecurityNo" Mask="d3-d2-d4" VerticalAlignment="Center"
                                                             TabIndex="11" Value="{Binding Path=SocialSecurityNo}" SelectionOnFocus="SelectAll"
                                                             ValueChanged="radSocialSecurityNo_ValueChanged" LostFocus="radSocialSecurityNo_LostFocus"
                                                             TextMode="MaskedText"  InputBehavior="Replace" />

2 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 08 Oct 2012, 06:27 AM
Hi Rod,

We managed to reproduce this issue in an isolated scenario using your code, Q2 2011 dlls,  and such kind of ViewModel:

this.DataContext = new ViewModel(){ SocialSecurityNo = "555-12-1212"};
This would have worked fine if the ViewModel's property is 555121212. Please make sure the database value has received the Value from the MaskedTextInput, not its Text.
However, the good news is that this works correctly with our latest Q2 2012 dlls. So we highly encourage you to upgrade.

Regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Rod
Top achievements
Rank 1
answered on 08 Oct 2012, 02:33 PM
It would be better if our database wasn't used in a way where the dashes of a social security number are also stored.  Unfortunately, it is.  And we've got dozens of reports, stored procedures, etc, which depend upon this format.  I'd like to change that, but haven't the time right now.  I hope that we'll be able to renew our Telerik license soon.
Asked by
Rod
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Rod
Top achievements
Rank 1
Share this question
or