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

RadMaskedTextBox Value is blank on callback

1 Answer 75 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
NCCanuck
Top achievements
Rank 1
NCCanuck asked on 05 Nov 2009, 04:23 PM
I am using the ServerSideValidationExtender with a custom PropertyProxyValidator in conjuction with a RadMaskedTextBox. When the PropertyProxyValidator fires the OnChanged event the value passed into the event is not the new value of the text box but rather the last value. So in the below example the page renders with the text 1111-11-11 in the box. I change the value to 1111-11-22. Tab out of the box. The PropertyProxyValidator does get fired but the value passed into the method is 11111111 not 11111122.

I know we can possibly use other controls for date entry but we have a requirement for displaying the edit mask and I am trying to evaluate how we can use our design for the validation with this RadMaskedTextBox. As well even if this was not a date the issue would be the same.

 

 

 

<telerik:RadMaskedTextBox ID="ServiceDateTextBox" runat="server" Mask="####-##-##" PromptChar="_" Text='11111111' />   
 
<HCFW:HCPropertyProxyValidator ID="HCPropertyProxyValidator1" runat="server" 
 
ControlToValidate="ServiceDateTextBox" PropertyName="ServiceDate" SourceTypeName="HC.Modules.Provider.PresentationEntities.Member, HC.Modules.Provider" /> 
 
<WCSFX:ServerSideValidationExtender ID="ServerSideValidationExtender1" runat="server" TargetControlID="HCPropertyProxyValidator1" /> 
 

 


Our OnValueConvert method has the following code in it for our HCPropertyProxyValidator implementation:

 

 

        private void OnValueConvert(object sender, ValueConvertEventArgs e)  
        {  
 
            if (e.TargetType.Equals(typeof(System.DateTime)))  
            {  
                string value = e.ValueToConvert as string;  
                DateTime convertedValue;  
 
                bool success = DateTime.TryParse(value,  
                        System.Threading.Thread.CurrentThread.CurrentUICulture,  
                        System.Globalization.DateTimeStyles.None,  
                        out convertedValue);  
 
                if (success)  
                {  
                    e.ConvertedValue = convertedValue;  
                }  
                else 
                {  
                    e.ConversionErrorMessage = "Date is not a valid value.";  
                    e.ConvertedValue = null;  
                }  
            }  
        } 

 

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 11 Nov 2009, 07:06 AM
Hi NCCanuck,

Unfortunately, we do not support issues with other third-party controls and Telerik RadControls. The best we can do is assist you in ensuring that RadMaskedTextBox works with standard ASP.NET validators.

Regards,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Ajax
Asked by
NCCanuck
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or