DataAnnotationsExtensions icon indicating copy to clipboard operation
DataAnnotationsExtensions copied to clipboard

Numeric/Range interaction

Open srkirkland opened this issue 13 years ago • 0 comments

[From Blog Comments, VincentG]

Hi Sir,

I am using your extensions for an ASP MVC3 VB project, and I really like the NumericAttribute extension, specifically because it can validate numeric strings with commas.

However when I combine NumericAttribute with, say, Range (built-in) or the extension's Min or Max, a weird thing happens. The Numeric test passes, but the range fails perhaps because of the comma.

In your sample site, for example, the MaxTenAndAHalf field, if you input -100000, it works. If you input -x, the correct error message appears: "The field MaxTenAndAHalf must be a number." Then, if you try -100,000... the error becomes: "The field MaxTenAndAHalf must be less than or equal to 10.5."

The same thing happens when I try to use the built-in Range annotation with the extension's Numeric attribute. As I would like to include commas in my application, is there any solution for the Range check to allow commas as well?

Thanks and have a nice day!

srkirkland avatar Oct 12 '11 03:10 srkirkland