Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit input to two decimal places

Status
Not open for further replies.

Peppi

Programmer
Apr 9, 2001
205
CA
Hi,

What's the easiest way to limit input that a user is entering into a textbox to just two decimal places, without limiting the number of digits that are in front of the decimal point?

Thx.
 
I would use a RegularExpressionValidator.

Set it to the control you want to validate and set the ValidationExpression to something from here:

Also, helps to set the Display = Dynamic, and remember to set the ErrorMessage.


Combine that with some server side validation on the postback just in case JavaScript is disabled and you will be set.


Senior Software Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top