I'm having some problems with my ASP.NET 4 application in Chrome & Safari (works in Firefox and IE).
I have a button declared using the following code:
<asp:Button ID="btnEOI1" runat="server" CssClass="buttonCSS" Text="Lodge an Expression of Interest"
OnClick="btnEOI_Click" CausesValidation="False" />
In the code-behind file I have the following code:
protected void btnEOI_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx", true);
}
Also on the page is a LoginControl that has two RequiredFieldValidators and a RegularExpressionValidator:
<asp:requiredfieldvalidator id="UserNameRequired" runat="server" ControlToValidate="UserName"
ErrorMessage="Please enter your User Name." SetFocusOnError="true" Display="None">
</asp:requiredfieldvalidator>
<asp:RegularExpressionValidator runat="server" id="RegularExpressionValidator1"
ControlToValidate="UserName"
ErrorMessage="Please enter your User Name without spaces." ValidationExpression="[\S]+"
Display="None" SetFocusOnError="true" >
</asp:RegularExpressionValidator>
<asp:requiredfieldvalidator id="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Please enter your Password." SetFocusOnError="true" Display="None">
</asp:requiredfieldvalidator>
When I click the button in Chrome and Safari, the UserNameRequired and PasswordRequired validators fire even though the button has CausesValidation="false". The validation errors do not occur in IE or Firefox.
How can I stop the validators from firing in Chrome and Firefox?