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

Is it possible to set the value of the MaskedText control programmatically?

3 Answers 31 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Louis asked on 31 Mar 2011, 11:18 PM
I'm trying to  create and populate a RadMaskedTextBox control within a Silverlight Project using the following code as an example.  However, Stepping through the code, the value of .MaskedText is nothing when it gets to the point of setting the variable Result.  Is it possible to set the RadMaskedTextBox control in code and if so what is the proper way to do it?
Thanks
Dim Result As String = "92881-0706"
Dim PostMask As String = "#####-####'
Dim mtb As New Telerik.Windows.Controls.RadMaskedTextBox
  
        If PostMask IsNot Nothing Then
            If PostMask.ToString.Length > 0 Then
                With mtb
                    .MaskType = Telerik.Windows.Controls.MaskType.Standard
                    .Mask = PostMask
                    .Value = PostalCode
                    Result = .MaskedText
                End With
  
            End If
        End If

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 06 Apr 2011, 11:55 AM
Hello Louis,

I cannot see where you have defined the "PostalCode" variable. Trying your code with "PostalCode" replaced with a sample string value works fine.

All the best,
Petar Mladenov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Louis
Top achievements
Rank 1
answered on 06 Apr 2011, 07:30 PM
Well testing again and stepping through the code .MaskedText is always Nothing.  

Here's a simple code snippet which should duplicate the issue in a Silverlight 4 application:
 
Dim Result As String = ""
Dim PostMask As String = "#####-####'  
Dim PostalCode = "02124"
Dim mtb As New Telerik.Windows.Controls.RadMaskedTextBox  
      
        If PostMask IsNot Nothing Then
            If PostMask.ToString.Length > 0 Then
                With mtb  
                    .MaskType = Telerik.Windows.Controls.MaskType.Standard  
                    .Mask = PostMask  
                    .Value = PostalCode  
                    Result = .MaskedText  
                End With
      
            End If
        End If
0
Petar Mladenov
Telerik team
answered on 12 Apr 2011, 09:40 AM
Hi Louis,

Unfortunately I am unable to reproduce your issue. Could you please examine my test project and let me know if I have missed something.

Regards,
Petar Mladenov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Louis
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Louis
Top achievements
Rank 1
Share this question
or