Learn what it takes to begin building ASP.NET Web sites with Visual Studio .NET. This article will provide you with the knowledge you need to jumpstart your foray into the world of ASP.NET development.
by Jim Duffy
May 9, 2003
Page 7 of 8
You can use the RegularExpressionValidator control to verify that the entry in a control conforms to a specified Regular Expression. This allows you to check an entry against a pattern such as a U.S. Social Security number, telephone number, email address, etc.
The following HTML code adds a RegularExpressionValidator named regPhoneNumber to watch over the txtPhone text box, which is also watched over by reqPhone, the RequiredFieldValidator:
ErrorMessage="Please enter a phone number!"
Figure 13shows the Property window for the regPhoneNumber RegularExpressionValidator control.