Reputation: 10344
I have a textbox which should allow user to enter only positive or negative decimal number with three decimal places. For Example: 73.345 or -2345.345 or -32.34. something like that. How to set the validation for this?
Whether validation is by either using Validation Controls or by JavaScript. Any suggestions please.
Upvotes: 0
Views: 1920
Reputation: 12164
I would use a RegularExpressionValidator to do the work for you. Your regular expression, assuming the decimal point and digits immediately following are options, is then:
-?\d+(\.\d{1,3})?
Upvotes: 4