Click here to Skip to main content
13,513,836 members
Rate this:
Please Sign up or sign in to vote.
See more:
How can I initiate a validator to check content in want a regular expression validator to to validate content on text change
Posted 1-Jan-13 23:04pm
Tadit Dash 2-Jan-13 5:09am
What type of content you are referring to?
Please be specific.
AkshayV 7-Jan-13 1:48am
Only characters
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


Try the following,

Adding ASP.NET validation at runtime[^][^]

If the above is not working, try the below

1. Add a using statement to reference the System.Text.RegularExpressions namespace.

2. Add the following code in your textchange event,

Regex reg = new Regex(@"^[a-zA-Z'.]{1,40}$");

// Static method:
if (!Regex.IsMatch(txtName.Text, 
  // Name does not match schema
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180417.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100