LinkButton::CausesValidation Property
Gets or sets a value indicating whether validation is performed when the LinkButton 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 LinkButton control is clicked; otherwise, false. The default value is true.
Implements
IButtonControl::CausesValidationBy default, page validation is performed when a LinkButton 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 a LinkButton 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 LinkButton 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.
Security Note
|
|---|
This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview. |
Available since 1.1
