Email Address

2 posts, 1 answers
  1. Eric Moore
    Eric Moore avatar
    25 posts
    Member since:
    Mar 2010

    Posted 17 May 2011 Link to this post

    Is there a way to use the masked input to force proper email address formatting?
    something along the lines of Mask="a25\@a25.LLL" or even better Mask="A3a25\@A3a25.L3"
    I'd like it so that when the user types an '@' it skips the rest of the email prefix characters.
    Same thing when they type the '.'
    Can anyone think of a simple way to do this where I don't have to check the characters pressed in the code behind. That just seems like it wouldn't be a very cost efficient trasaction.

  2. Answer
    Alex Fidanov
    Alex Fidanov avatar
    636 posts

    Posted 19 May 2011 Link to this post

    Hi Eric Moore,

    The control does not support this, however, what you can do is to validate the input against a regular expression. For example:

    public class Context : ViewModelBase
        private string emailAddress;
        public string EmailAddress
            get { return emailAddress; }
                emailAddress = value; 

    <telerik:RadMaskedTextInput Mask="a30" Value="{Binding EmailAddress, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"/>

    In case of invalid input, a red border will be craeted around the control prompting for the error. Moreover, you can customize this by craeting and applying an Error template through the Validation.ErrorTemplate attached property.

    Alex Fidanov
    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
  3. DevCraft banner
Back to Top