System.Web.UI.WebControls Namespace BaseValidator Class
Sets or retrieves a value specifying whether the associated input control passes validation.
Script |
Validator.IsValid [ = true | false ] |
This property can only be used programmatically; it cannot be set when declaring the control.
This property accepts or returns only a boolean value: true if the associated input control passes validation; otherwise, false. Default value is true.
Use the IsValid property to determine whether the associated input control passes validation.
Since the default value of this property is true, it will return true if you query this property before validation is performed. For example, this might occur if you attempt to use this property in the Control.Load event of page.
The IsValid property is only evaluated when the Validate method is called. You can call the Validate method for each validation control on the page individually, or call all of them at once by using the Page.Validate method. Button controls with their CausesValidation property set to true will also call the Page.Validate method.
It is possible to change the value of this property manually after validation has taken place. This allows you to override the validation result, if necessary.
The Page.IsValid property for the page is set to true only if the IsValid property for each validation control on the page is also set to true.
BaseValidator Members Base Validation Control Properties