Subscribe Now!

Enter your email address:

Tuesday, January 18, 2011

Email Validation from Codebehind



if (System.Text.RegularExpressions.Regex.IsMatch(txtNewsletter.Text, "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{1,3})$") == false)
{
Page.RegisterStartupScript("GetType", "<script language='javascript'>alert('Please enter valid email address!')</script>'");
}

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...