Thursday, 9 February 2017

Regular Expression Validator for email in VB.NET or ASP.NET

Dear All.

For email validation place range validator in the user form and edit the code with the given 'ValidationExpression" as  below.

<asp:RegularExpressionValidator ID="validateEmail"    
  runat="server" ErrorMessage="Invalid email."
  ControlToValidate="txtEmail" 
  ValidationExpression="^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$" />
 
 
All the best.