ImageButton::CausesValidation Property
Gets or sets a value indicating whether validation is performed when the ImageButton control is clicked.
Assembly: System.Web (in System.Web.dll)
public: [ThemeableAttribute(false)] property bool CausesValidation { virtual bool get(); virtual void set(bool value); }
Property Value
Type: System::Booleantrue if validation is performed when the ImageButton control is clicked; otherwise, false. The default value is true.
Implements
IButtonControl::CausesValidationBy default, page validation is performed when an ImageButton control is clicked. Page validation determines whether the input controls associated with a validation control on the page all pass the validation rules specified by the validation control.
You can specify or determine whether validation is performed on both the client and the server when an ImageButton control is clicked by using the CausesValidation property. To prevent validation from being performed, set the CausesValidation property to false.
This property is commonly set to false for a Reset or Clear button to prevent validation from being performed when the button is clicked.
When the value of the CausesValidation property is set to true, you can also use the ValidationGroup property to specify the name of the validation group for which the ImageButton control causes validation.
This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.
The following example demonstrates how to use the CausesValidation property to prevent page validation from occurring. Notice how the Validate method activates each validation control independently.
Note |
|---|
The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Forms Page Code Model. |
Available since 1.1
