-1

My Model (Generated from db sql server):

public partial class Wagons
{
public int ID {get; set;}
public decimal Poids {get; set;}

 }

And with Entity Framework I generated my Controller and View.

When I tried to enter the data I got something like this:enter image description here

and my propriety is Decimal, I replaced "," by "." I got an other error : The value is not valid for... enter image description here How can I fix this please? Regards

lot
  • 39
  • 7

1 Answers1

0

AspNet tries to parse string to decimals based on the active Culture info

In USA the decimal separator is a dot (.)

in for example The netherlands this is a comma (,)

and thus depending on the culture settings some formats can and some formats can't be parsed to decimals

read more: https://learn.microsoft.com/en-us/dotnet/standard/base-types/parsing-numeric

Joel Harkes
  • 10,975
  • 3
  • 46
  • 65
  • @CodeCaster you don't know it could be after a post or ajax call. since the tag is aspnet i answer the aspnet way. – Joel Harkes Mar 09 '18 at 10:38