Guides (SDK /API)Technical ReferenceBBDNHow-to Documentation

You are here: Custom Parts Example: Pledge Form > Add Field Validatation for Email

Add Field Validatation for Email

Code sample project: Custom Pledge Form

Note: For some common regular expressions for field validation, see Microsoft's MSDN article at: How To: Use Regular Expressions to Constrain Input in ASP.NET. There are also some default regular expressions in the editor for the ValidationExpression field on the Properties window for the RegularExpressionValidator control.

Add a regular expression validator to ensure that TextBoxEmail has a valid email address.

    <asp:RegularExpressionValidator ID="RegularExpressionValidatorEmail" 
        ControlToValidate="TextBoxEmail" 
        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
        runat="server" ErrorMessage=" Invalid email address"></asp:RegularExpressionValidator>