I used a ASP .NET CompareValidator to validate a floating point amount in a textbox.

While testing the application, I noticed that "0.05" would work, but "0.052", "0.0521", "0.05213" wouldn't? They were all valid numbers, but for some reason the validator was saying it wasn't?

Its turns out that theconfigured Currency data-type only allows the regional default of decimal places. Since the Regional Settings was for UK and the decimal places were 2, it wasn't technically a valid currency over 2 decimal places.

Instead I used the Double data-type to validate against, and then cast that to a decimal.

Hope this helps, as it totally baffled me!


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
posted @ Thursday, June 05, 2008 3:52 PM |

Comments

No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  


Please add 3 and 7 and type the answer here: