Reputation: 139
Is giving error when I'm putting in my modal "?" beside my decimal variable
Model:
[Display(Name = "Valor Pago:")]
public decimal? decLancamentoReceitaDespesaValorPago { get; set; }
When I put any value in the field with the mask value of Brazil, the following error occurs:
"The value '1.111,11' is not valid for Valor Pago.:" ?
This error does not happen if the decimal field is mandatory, does anyone know what is happening? I can not leave my decimal field allowing null?
Upvotes: 1
Views: 1416
Reputation: 9145
The error message you are getting does not have anything to do with the decimal
value being null
or not. It has to do with mask value of Brazil you are using. You need to create your own custom model binder for decimal in order to fix that issue. This post will point you into the right direction (coincidently, the post is also about Brazil):
Upvotes: 3