搞一种最简单的验证给你:
int intOutput = 0; if (Int32.TryParse(txtNumericTest.Text, out intOutput)) { Response.Write("Valid int"); } else { Response.Write("Not a Valid int"); } //To check Double values double dOutput = 0; if (Double.TryParse(txtNumericTest.Text, out dOutput)) { Response.Write("Valid double"); } else { Response.Write("Not a Valid double"); }