validating a textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have a textbox in a c# asp.net webform. i am using a
regularexpressionvalidator control to validate the textbox. only numbers are
allowed in it. in my regularexpressionvalidator control property window, i
couldnt find the right validation expression to use to make it work properly.
thanks in advance.
 
Newbie said:
i have a textbox in a c# asp.net webform. i am using a
regularexpressionvalidator control to validate the textbox. only numbers
are
allowed in it. in my regularexpressionvalidator control property window, i
couldnt find the right validation expression to use to make it work
properly.
thanks in advance.

bool IsNumeric(string pstrValue)
{
Regex isNumber = new Regex(@"^\d+$");

Match m = isNumber.Match(pstrValue);
return m.Success;
}
 
Back
Top