title: I am unable to cancel an ASP.NET page
body: <p>I am new to web programming. I have a pretty standard page that accepts contact information and I am trying to add validation controls to it. When the user clicks the cancel button nothing is saved so I just want to unload the page and go back to the previous page. My problem is, even the the cancel button has <code>CausesValidation="false</code> the validation events are still firing and a post back does not occur. I am using Visual Studio 2012 and C#. I've created a test page to reduce the code I'm working with to the minimum required code to demonstrate the issue. I have tried the javascript disableValidation() function with both Page_Validation = false; and the loop to disable the individual validation controls without success. When I check Page_Validation it is false, and the loop throws the exception <strong>Page_Validators is undefined</strong>.</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestMe.aspx.cs" Inherits="ElmoWeb.TestMe" %&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
  &lt;head id="Head1" runat="server"&gt;
      &lt;title&gt;Simple Little Test Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
          &lt;div&gt;
              &lt;asp:TextBox ID="uxEmail" runat="server" placeHolder="email address" type="email" AutoCompleteType="Email"&gt;&lt;/asp:TextBox&gt;
              &lt;asp:RegularExpressionValidator ID="uxEmailValidator" runat="server"
                  ControlToValidate="uxEmail"
                  ValidationExpression="^[a-zA-Z][\w\._%+-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
                  ErrorMessage="The email address is invalid"
                  EnableClientScript="false" ValidationGroup="testing"
                  Display="Static"/&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;asp:Button ID="Submit" runat="server" Text="Submit" CausesValidation="true" UseSubmitBehavior="true" ValidationGroup="testing" /&gt;
              &lt;asp:Button ID="Cancel" runat="server" Text="Cancel" CausesValidation="false" UseSubmitBehavior="true" ValidationGroup="FakeValidationGroup" /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List" HeaderText="You must correct the following errors." ValidationGroup="testing" /&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Currently the code behind just writes a message to the output window so I can see if the post back occurred.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      System.Diagnostics.Debug.WriteLine("TextMe.aspx Page_Load event, sender = " + sender.ToString() + ", EventArgs = " + e.ToString());
  }
  </code></pre>