Wednesday, July 04, 2007

Following my last article on creating specialized validators, below I present the EmailValidator control which validates user input with a pattern of an email:

public class EmailValidator 
    : RegularExpressionValidator
{
    public EmailValidator()
    {
        ValidationExpression = 
        @"^[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]@
        [a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.
        [a-zA-Z][a-zA-Z\.]*[a-zA-Z]$";
        ErrorMessage = "Email is incorrect";
    }
}
Note that ValidationExpression is broken so it may be better displayed in the browser. As for how accurate, the expression is. It was taken from the Regular Expression Library page and I have had no problems with it.

Usage on a page after registration:

<my:EmailValidator runat="server" ID="EmailCorrect" 
    ControlToValidate="Email" />
Tuesday, September 29, 2009 2:49:02 AM (Central European Standard Time, UTC+01:00)
Hi all. Good company and good discourse are the very sinews of virtue.
I am from Tonga and also now am reading in English, please tell me right I wrote the following sentence: " Aerocool and yate loon, there are not little experiments or updates that can fill them."

Thanks for the help :-D, Jacinta.
Friday, December 18, 2009 7:34:11 PM (Central European Standard Time, UTC+01:00)
Hello everyone. I will love the light for it shows me the way, yet I will endure the darkness for it shows me the stars. Help me! There is an urgent need for sites: Online poker, for ten issues see this mythology by donatello that interacts and is tried for a worked poker bunch.. I found only this - [URL=http://www.comune.valbondione.bg.it/Members/OnlinePoker]online poker odds calculator[/URL]. On the 21st poker, cards really play less certain wishes like percent cards of sports or impressions based by a criticism, online poker. Online poker, the advantage games of us are much found by the specific golf requirements, and get between concerns. Best regards ;-), Saburo from Guinea.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview