Email Validation from Codebehind
Posted by : sarav
on 4:10 AM
This is for check the email address from codebehind using regular expression.
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>'");
}
Labels:
email validation,
javascript,
JS,
regular expression
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment