This documentation is archived and is not being maintained.

Base Validation Control Properties

The properties listed in the following table apply to all validation controls.


ControlToValidate The programmatic ID of the input control that the validation control will evaluate. If this is not a legitimate ID, an exception is thrown.
Display The display behavior for the specified validation control. This property can be one of the following values:

None — The validation control is never displayed inline. Use this option when you want to show the error message only in a ValidationSummary control.

Static — The validation control displays an error message if validation fails. Space is allocated on the Web page for the error message even if the input control passes validation. The layout of the page does not change when the validation control displays its error message. Because the page layout is static, multiple validation controls for the same input control must occupy different physical locations on the page.

Dynamic — The validation control displays an error message if validation fails. Space for the error message is allocated dynamically on the page when validation fails. This allows multiple validation controls to share the same physical location on the page.

Note   Since space for the validation control is created dynamically, the physical layout of the page changes. In order to prevent the page layout from changing when a validation control becomes visible, the HTML element containing the validation control must be sized large enough to accommodate the maximum size of the validation control.
EnableClientScript Indicates whether client-side validation is enabled. You can disable client-side validation on browsers that support this capability by setting the EnableClientScript property to false.
Enabled Indicates whether the validation control is enabled. You can prevent the validation control from validating an input control by setting this property to false.
ErrorMessage The error message to display in the ValidationSummary control if validation fails. If the Text property of the validation control is not set, this text is also displayed in the validation control when validation fails. The ErrorMessage property is commonly used to provide different messages for the validation control and the ValidationSummary control.
Note   This property does not convert special characters to HTML entities. For example, the less than character (<) is not converted to &lt;. This allows you to imbed HTML elements, such as an <img> element, in this property's value.
ForeColor Specifies the color to display the inline message when validation fails.
IsValid Indicates whether the input control specified by the ControlToValidate property is determined to be valid.
Text When set, this message is displayed in the validation control when validation fails. If this property is not set, the text specified in the ErrorMessage property is displayed in the control.

See also

BaseValidator Class | Validation Server Controls