Ken Barrett

Ken Barrett

  • NA
  • 123
  • 0

scan a string (should be an easy one) ... (I hope)

Feb 13 2009 1:19 PM
I'm relatively new to C# and ASP.NET (came from the PERL (CGI) world).

I am looking at a string the user is going to enter in a text box, and want to determine whether or not it could be a name.

A name doesn't have any numbers in it, and the entire string should contain at least 2 spaces and at most 3 spaces (first middle last).


I have attempted using required field validators and custom validators, for SOME of the code (Credit Card Number, etc.), but oddly enough the custom validators are bypassed when the "Submit" button is clicked (with PostBackUrl pointing to the next page). So I've decided to write my own validators, and if all passes then write the data into SQL, and follow up with a "thank you" page using Response.Redirect.


Since this is a common problem, I am supposing that there is a common solution.

My question is, what is the common solution to this common problem? (scanning the string to see if it's a name)

TIA

Answers (4)