System.Web.UI.WebControls Namespace BaseValidator Class
Sets or retrieves a value specifying whether the validation control is enabled.
Inline |
<asp:validator enabled [ = true | false ] ... > |
Script |
Validator.Enabled [ = true | false ] |
This property accepts or returns only a boolean value: true if validation for the control is enabled; otherwise false. Default value is true.
Use the Enabled property to specify whether the validation control is enabled. You can programmatically disable the validation control by setting this property to false.
Setting either the Control.Visible or Enabled properties to false will prevent validation from being performed. This causes the IsValid property to always evaluate to true.
The Enabled property is slightly different from the Control.Visible property. If the Control.Visible property for a validation control is set to true, but the Enabled property is set to false, the validation control is still rendered for client-side validation, but in a disabled state. You can then re-enable the validation control on the client by using client-side script.
The following example demonstrates how to programmatically set the Enabled property to enable or disable a validation control on the Web page at run time.
Show me
BaseValidator Members Base Validation Control Properties Disabling Validation at Run Time