Easy Tutorial
❮ Prop Webcontrol Calendar Dayheaderstyle Mvc Publish ❯

ASP.NET RegularExpressionValidator Control



Definition and Usage

The RegularExpressionValidator control is used to validate whether the input value matches a specified pattern.

Note: Server-side and client-side validation will be performed simultaneously unless the browser does not support client-side validation or the EnableClientScript property is set to false.

Note: If the input control is empty, validation will fail. Use the RequiredFieldValidator control to make the field required (mandatory).


Properties

Property Description
BackColor The background color of the RegularExpressionValidator control.
ControlToValidate The ID of the control to validate.
Display The display behavior of the validation control. Legal values are: None - The control does not display. Used only to display error messages in the ValidationSummary control.<br> Static - The control displays an error message if validation fails. Space for the message is reserved on the page even if the input passes validation.<br> Dynamic - The control displays an error message if validation fails. Space for the message is dynamically added to the page if the input passes validation.
EnableClientScript A Boolean value that specifies whether client-side validation is enabled.
Enabled A Boolean value that specifies whether the validation control is enabled.
ErrorMessage The text displayed in the ValidationSummary control when validation fails. Note: If the Text property is not set, this text is also displayed in the validation control.
ForeColor The foreground color of the control.
id The unique ID of the control.
IsValid A Boolean value indicating whether the control specified by ControlToValidate passed validation.
runat Specifies that the control is a server control. Must be set to "server".
Text The message displayed when validation fails.
ValidationExpression The regular expression that specifies the pattern for validating the input control. The syntax of the expression differs between the client and the server. JScript is used on the client. On the server, the syntax depends on the language specified.

Example

RegularExpressionValidator


❮ Prop Webcontrol Calendar Dayheaderstyle Mvc Publish ❯