ASP.NET CausesValidation property

Definition and usage

The CausesValidation property specifies whether the page is validated when the ImageButton control is clicked.

By default, page validation is executed when the button is clicked.

This property is mostly used to prevent validation from being performed when the cancel or reset button is clicked.

Syntax

<asp:ImageButton CausesValidation="TRUE|FALSE" runat="server" />

Example

The following example cancels the validation when the ImageButton is clicked:

<form runat="server">
<asp:ImageButton id="button1" runat="server"> 
CausesValidation="FALSE" ImageUrl="img.gif" />
</form>

Example

Set the CausesValidation of the ImageButton control to false