Validation of emails

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

Hi,

Can someone give me suggestions on how to validate emails that are entered
into a textbox?
the problem is that they can enter any number of emails say the textbox is
called Notificationlist and has 10 email addresses, i need to read this and
validate all the emails before inserting into the DB

thanks,
Stephen
 
You can use RegularExpressionValidator.

<asp:RegularExpressionValidator id="Regularexpressionvalidator"
runat="server"
ControlToValidate="txtEmail"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*"
ErrorMessage="<br>* Check email"
CssClass="alert"
ForeColor=""
display="dynamic">
</asp:RegularExpressionValidator>

The specific validation expression lets you enter a list of emails
separated by comma or semicolon. When it's validated, you can split it
up into individual email addresses and you're good to go.

Hope it helps,
Amie
 
thanks Amie,
It works, if u can please suggest a good link for regularexpressions that
will be great.
stephen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top