I need to have a textbox be validated as an email address, and make it a required field. I also need to restrict the email addresses to a specific domain name only (e.g. @example.com).
<asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>'
MaxLength="50" />
What is the best approach to this?
It would work better if you add
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
instead of
ValidationExpression="^\w+([-+.']\w+)*@domain.com$"
in the code above