ASP.NET form with Submit and Cancel Button
<p>I created a form inn ASP.NET .The code is shown below</p>

<pre><code>&lt;form id="AddSchool" method="post" runat="server"&gt;
&lt;span class="failureNotification"&gt;
    &lt;asp:Literal ID="ErrorMessage" runat="server" &gt;&lt;/asp:Literal&gt;
&lt;/span&gt;
&lt;asp:ValidationSummary ID="AddSchoolValidationSummary" runat="server" CssClass="failureNotification" ValidationGroup="AddSchoolValidationGroup"/&gt;
&lt;asp:Label ID="SchoolNameLabel" runat="server" Text="School Name " AssociatedControlID="SchoolName"&gt;&lt;/asp:Label&gt;
&lt;asp:TextBox ID="SchoolName" runat="server" Height="16px" Width="337px" CssClass="textEntry"&gt;&lt;/asp:TextBox&gt;
&lt;asp:Label ID="Label15" runat="server" Font-Size="Larger" ForeColor="Red" Text="*"&gt;&lt;/asp:Label&gt;
&lt;asp:RequiredFieldValidator ID="SchoolNameRequired" ControlToValidate="SchoolName" CssClass="failureNotification"  runat="server" ErrorMessage="School Name is Required" ToolTip="School Name is Required"
    ValidationGroup="AddSchoolValidationGroup"&gt;&lt;/asp:RequiredFieldValidator&gt;

&lt;asp:Label ID="StreetAddressLabel" runat="server" Text="Street Address " AssociatedControlID="StreetAddress"&gt;&lt;/asp:Label&gt;
&lt;asp:TextBox ID="StreetAddress" runat="server" Height="16px" Width="338px" CssClass="textEntry"&gt;&lt;/asp:TextBox&gt;
&lt;asp:Label ID="Label16" runat="server" Font-Size="Larger" ForeColor="Red" Text="*"&gt;&lt;/asp:Label&gt;
&lt;asp:RequiredFieldValidator ID="StreetAddressRequired" ControlToValidate="StreetAddress" CssClass="failureNotification" runat="server"
     ErrorMessage="Street Address is Required" ToolTip="Street Address is Required" ValidationGroup="AddSchoolValidationGroup"&gt;&lt;/asp:RequiredFieldValidator&gt;

&lt;asp:Label ID="CityLabel" runat="server" Text="City " AssociatedControlID="City" &gt;&lt;/asp:Label&gt;
&lt;asp:TextBox ID="City" runat="server" Height="16px" Width="340px" style="margin-left: 0px" CssClass="textEntry"&gt;&lt;/asp:TextBox&gt;
&lt;asp:RequiredFieldValidator ID="CityRequired"  runat="server" ControlToValidate="City" CssClass="failureNotification"
     ErrorMessage="City is Required" ToolTip="City is Required" ValidationGroup="AddSchoolValidationGroup"&gt;&lt;/asp:RequiredFieldValidator&gt;

&lt;asp:Label ID="StateLabel" runat="server" Text="State " AssociatedControlID="StateList"&gt;&lt;/asp:Label&gt;
&lt;asp:DropDownList ID="StateList" runat="server" Height="25px" Width="119px" DataSourceID="SqlDataSource1" DataTextField="StateName" DataValueField="StateName" CssClass="textEntry"&gt;
 &lt;asp:ListItem&gt;Select A State&lt;/asp:ListItem&gt;
&lt;/asp:DropDownList&gt;
&lt;asp:Label ID="Label17" runat="server" Font-Size="Larger" ForeColor="Red" Text="*"&gt;&lt;/asp:Label&gt;
&lt;asp:RequiredFieldValidator ID="StateRequired" runat="server" Display="Dynamic" ControlToValidate="StateList" CssClass="failureNotification"
     ErrorMessage="A State is Required" ToolTip="A State is Required" ValidationGroup="AddSchoolValidationGroup"&gt;&lt;/asp:RequiredFieldValidator&gt;

&lt;asp:Label ID="ZipLabel" runat="server" Text="Zip Code :" AssociatedControlID="ZipCode"&gt;&lt;/asp:Label&gt;
&lt;asp:TextBox ID="ZipCode" runat="server" Width="139px" CssClass="textEntry"&gt;&lt;/asp:TextBox&gt;
&lt;asp:RequiredFieldValidator ID="ZipCodeRequired" runat="server" ControlToValidate="ZipCode" CssClass="failureNotification"
     ErrorMessage="Zip Code is Required" ToolTip="Zip Code is Required" ValidationGroup="AddSchoolValidationGroup"&gt;&lt;/asp:RequiredFieldValidator&gt;

&lt;asp:Label ID="EmailLabel" runat="server" Text="Email Address" AssociatedControlID="Email"&gt;&lt;/asp:Label&gt;:
&lt;asp:TextBox ID="Email" runat="server" Width="304px" Height="16px" CssClass="textEntry"&gt;&lt;/asp:TextBox&gt;
&lt;asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email" CssClass="failureNotification" 
    ErrorMessage="E-mail is required." ToolTip="E-mail is required."  ValidationGroup="AddSchoolValidationGroup"&gt;*&lt;/asp:RequiredFieldValidator&gt;
&lt;asp:RegularExpressionValidator ID="EmailFormat" runat="server"  ControlToValidate="Email" CssClass="failureNotification" 
    ErrorMessage="The email address entered does not appear to be valid." ValidationGroup="AddSchoolValidationGroup" 
     ValidationExpression="([A-Z]|[a-z]|[0-9])+[@]([A-Z]|[a-z]|[0-9])+\.([A-Z]|[a-z]){2,6}" Display="Dynamic"&gt;*&lt;/asp:RegularExpressionValidator&gt;

 &lt;asp:Label ID="ConfirmEmailLabel" runat="server" Text="Confirm Email Address " AssociatedControlID="ConfirmEmail"&gt;&lt;/asp:Label&gt;:
&lt;asp:TextBox ID="ConfirmEmail" runat="server" Height="18px" Width="304px" CssClass="textEntry"&gt;&lt;/asp:TextBox&gt;
&lt;asp:RequiredFieldValidator ID="ConfirmEmailRequired" runat="server" ControlToValidate="ConfirmEmail" CssClass="failureNotification"
     ErrorMessage="Confirm E-mail is required." ToolTip="Confirm E-mail is required." 
     ValidationGroup="AddschoolValidationGroup"&gt;*&lt;/asp:RequiredFieldValidator&gt;
&lt;asp:CompareValidator ID="EmailCompare" runat="server" ControlToCompare="Email" ControlToValidate="ConfirmEmail" 
      CssClass="failureNotification" Display="Dynamic" ErrorMessage="E-mail and Confirm E-mail must match."
       ValidationGroup="AddSchoolValidationGroup"&gt;*&lt;/asp:CompareValidator&gt;
&lt;asp:Label ID="Label14" runat="server" ForeColor="Red" Text="* = Required"&gt;&lt;/asp:Label&gt;

&lt;asp:ImageButton ID="Cancel" runat="server" OnClick="cancelClick" ImageUrl="~/Styles/images/cancel-btn.png" /&gt;
&lt;asp:ImageButton ID="Submit" runat="server" OnClick="submitClick" ImageUrl="~/Styles/images/submit-btn.png" /&gt;
&lt;/form&gt;
</code></pre>

<p>This form contains some fields like School name,street address,city,email,conform email etc..Along with Asp.net validation controls and two image buttons, one is named as cancel and other is named as submit.When i click on submit i want to validate the form using that validation controls and raise an event "submitclick".And when i click on cancel i want to raise an event cancelclick.Can anyone explain how to validate the form when i click submit 'image button'.</p>
