Click to Rate and Give Feedback
MSDN
MSDN Library

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
ASP.NET Mobile Web Pages
Introduction to the RegularExpressionValidator Control

Use the RegularExpressionValidator control to test whether the user input in a TextBox or SelectionList control matches a regular expression. Set the RegularExpressionValidator control's ControlToValidate to the ID of the TextBox or SelectionList control to validate.

ASP.NET Regular Expression Validator

The RegularExpressionValidator control performs validation by comparing the user input to the regular expression pattern specified in its ValidationExpression property. You can write your own regular expressions or select from a list of predefined expressions. For details, see How to: Add and Configure a RegularExpressionValidator Control.

If the user input value in the targeted control does not match the regular expression in the ValidationExpression property, the RegularExpressionValidator control displays the text defined in its ErrorMessage property.

When you add a RegularExpressionValidator control to a container control or template:

  • The ErrorMessage property is set to "RegularExpressionValidator".

  • The StyleReference property is set to "error", which is the name of a predefined style in the default StyleSheet instance.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker