ASP.Net validation

I want to check the value the user enters into the textbox so that it only enters floating point numbers. I'm not interested in the range. How can I do this, given also the culture localization information (eg "." Or "," as delimiters)?

0


source to share


1 answer


My usual method is to use RegexValidator with a validation expression ^(\d+(\.\d*)?)|(\d*(\.\d+))$

. You can change this to include "." or "": ^(\d+([\.,]\d*)?)|(\d*([\.,]\d+))$

.

If you want to be strictly correct, you must include the correct validation expression for each culture.



Also note that you still need the RequiredFieldValidator if this value is required.

+1


source







All Articles