ASP.NET Web Forms Web Forms Server Controls Web Forms Validation
At times, you might want to disable validation. In server code, you can disable server-side validation for individual controls.
You can manipulate client-side validation in two ways:
- Permanently disable it. This is useful if you want to ensure that there is no client-side validation even in browsers that support DHTML.
- Bypass client-side validation when the page is submitted. By default, if client validation is in effect, the page cannot be submitted to the server until all validation errors are resolved. Sometimes, however, you want to override errors. For example, in a multi-part page, it might be possible for a user to fix an entry error on the subsequent page.
- In HTML view, add the attribute
clienttarget=downlevel
to the Page directive at the top of your Web Forms page. The resulting directive might look like this:
<%@ Page Language="VB" codebehind="WebForm1.vb"
Inherits="MyProj.WebForm1" clienttarget=downlevel %>
NOTE: Disabling client validation this way also disables all other client-side functionality for server controls. For example, font and color information will be rendered in a <FONT> tag rather than as style attributes.
<input type=image runat=server Value="Cancel"
onclick="Page_ValidationActive=false;"
onserverclick=cmdCancel_Click >
Data Entry Validation ( Client-Side )