I am using FluentValidation to validate data in my MVC project. I have a decimal value that I am entering on a page, but if a comma is included in it then validation fails for it. For example "12,000.00". How can I get FluentValidation to accept such values?
            Asked
            
        
        
            Active
            
        
            Viewed 1,950 times
        
    0
            
            
        - 
                    You could try a regex validator. Regex example here: http://stackoverflow.com/a/1566016/2181514 – freedomn-m Jun 04 '15 at 13:55
- 
                    1After you solve problem with validation, model-binding problem can become actual http://stackoverflow.com/questions/6520005/problem-with-double-values-binding – David Levin Jun 04 '15 at 20:56
1 Answers
0
            I got this to work by creating a custom binder for decimal values. This should work regardless of what validation tool you're using. See this link on how to do that:
http://haacked.com/archive/2011/03/19/fixing-binding-to-decimals.aspx/
 
    
    
        Rono
        
- 3,171
- 2
- 33
- 58