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 most commonly 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 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