I want my users to choose if they want to use an email address or not when registering. I have the web.config file set to "requiresUniqueEmail="true" so all email addresses will be unique if they want to use one.
When I use the "if (emailAddress.Text == null)" line of code, the page throughs the "not a valid email address" error. If I comment out the line, the only value entered into the database is the "UserName@TBDSitename.com" text.
So, how can I write my code so that if the user enters an email address, that address will be used, otherwise it will execute the code I have for the address?
I have the following code for the aspx and code-behind:
<asp:textbox id="Email" runat="server"></asp:textbox>
<span style="color: #FF0000">(Optional)</span>
<asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" errormessage="Enter your email"
&nb ...
Go to the complete details ...