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

MaskedTextInput Reg Ex UpperCase issue

1 Answer 121 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Karthik
Top achievements
Rank 1
Karthik asked on 06 Sep 2012, 06:23 PM

Hello,

I have following xaml in my project 
<
telerik:RadMaskedTextInput Margin="15"                                     Mask=">a13"                                     EmptyContent="Enter rfc"                                     Value="{Binding Path=TestString,Mode=TwoWay, ValidatesOnNotifyDataErrors=True, ValidatesOnExceptions=true, NotifyOnValidationError=True}"/> and following property in viewmodel
 private string _testString = "";
        [RegularExpression(@"^([A-Z]{4})\d{6}([A-Z\w]{3})$")]
        public string TestString
        {
            get { return _testString; }
            set
            {
                _testString = value;
                RaisePopertyChanged("TestString");
            }
        }

What i am trying to do is enforce uppercase(">") with length of 13
Issue is, when started typing in above box ,text was all lower case until i entered a valid text("TTTT000000TTT")
 then it changes to upper case

If i take out "[RegularExpression(@"^([A-Z]{4})\d{6}([A-Z\w]{3})$")]" , above from my property, and start typing 
it is all uppercase like i want, But i do want to use my reg ex

Am i missing something here ?


-Karthik

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 11 Sep 2012, 06:50 AM
Hi Karthik,

Please find attached a project with latest official telerik assemblies where you can take advantage of the AllowInvalidValues property and set it to true. This way the setter of the property will fire and you will be able to validate your property with the Validator.ValidateProperty method. Actually this is how the Validation should be performed when it comes up to DataAnnotation Attributes (RegularExpression is part of them). This will be reflected in our documentation till the end of this week.
Hope this is suitable for you. 

All the best,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Karthik
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or