asp.net compare validators to allow comma and dot (both!) as decimal separator

Posted by DanC on Stack Overflow See other posts from Stack Overflow or by DanC
Published on 2010-02-04T21:42:34Z Indexed on 2010/05/14 13:24 UTC
Read the original article Hit count: 352

Filed under:
|
|
|

I am using a compare validator, which validates that the entered number is a valid double and also validates it against a given value (greater than zero). I am validating money amounts. Because of the location where the app is used, the locale sets the comma as the decimal separator. The problem is that when a user enters the value using the numeric keyboard, the number gets written with the dot as decimal separator, and is rejected by the validation.

I'd like to have this validation done before triggering a postback (like a customvalidator would) and accepting both separators.

Any ideas?

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about validators