0

I'm developing from Brazil. Here, the default number format is, by example, "1.000,00" (dots instead of commas, and vice-versa).

My problem is with the default settings for MVC Core 2. Just create a default ASP.Net MVC Core Web App, create a model like this:

public class TestModel
{
    public decimal Salary { get; set; } = 1.5M
}

Create the default scaffoldings for this models, and you will see this page:enter image description here

Asp.Net MVC correctly detects my culture, and display the value with commas instead of dots. The funny part is when I try submit this:

enter image description here

Ok, the page displays correctly, but the validation ui dont get my culture correctly... I think this bizzarre, show data in some culture and expect receive back in other culture is... inconsistent. But, ok, for sake of tests, I change "1,50" to "1.50". I submit and I receive this on the server side:

enter image description here

I have LOTS of solutions for this problem, but I think really odd this behaviour. If the user is expected receive data in one format, by default, I think must be displayed in the same format.

But ok, what the correct (expected?) way to manage this situation?

Click Ok
  • 8,700
  • 18
  • 70
  • 106
  • @mjwills The error comes from JS. I dont added the error, its everything default of Asp.Net Core MVC – Click Ok Jun 18 '18 at 04:14
  • Possible duplicate of [The field must be a number](https://stackoverflow.com/questions/30449026/the-field-must-be-a-number) – mjwills Jun 18 '18 at 04:16

0 Answers0