4.1 ASP.NET RegularExpressionValidator Control properties

In the previous chapter you learnt an ASP.NET tutorial on how to use ASP.NET RegularExpressionValidator Control . The following are some of the important attributes/properties used together with the ASP.NET RegularExpressionValidator Control.

Property

Description

BackColor

Property to set the background color for the Control

ControlToValidate

Property to set the id of the ASP.NET Control to validate

Display

Property to set the display behavior for the ASP.NET validation control.

  • None – does not display the validation and only displayed in the ASP.NET ValidationSummary control.
  • Static – displays the validation message if check fails. The space of the control is reserved even if the check passes.
  • Dynamic – displays the validation message if check fails. The space of the control is not reserved if the check passes.
EnableClientScript

Property to set a Boolean value to specify if client-side validation is enabled or disabled.

Enabled

Property to set a Boolean value to specify if validation control is enabled or disabled.

ErrorMessage

Property to set the Validation text to be displayed in the ValidationSummary Control when the validation check fails. Even if the text property is not set, the default text will be displayed in the validation control.

ForeColor

To set the foreground color of the ASP.NET CustomValidator Control

id

A unique ID for the ASP.NET CustomValidator Control

IsValid

Property to set a Boolean value to indicate if the control specified by ControlToValidate is determined to be valid.

runat

To indicate that the Control is a server control (by setting it to server)

Text

To set the validation text message to be displayed when check fails.

ValidationExpression

To specify the expression used to as the validation for the input control. The Validation expression syntax is different on the client side than on the server side.

  • Jscript is used on the Client side
  • Any language specified will be used on the Server side

Table of Contents