4
I am facing difficulty in working with monetary values (decimals) using web application, asp.net MVC
, with database Mysql. The problem is I can’t edit decimal values, like: 53.50, or 53.50. I can’t save using a semicolon. The problem is also that web.config is already set up globalization with en.
Follows the model:
[DisplayName("Preço:")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:C}")]
public Nullable<decimal> preco { get; set; }
Follow the view:
<div class="form-group">
@Html.LabelFor(model => model.preco, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.preco, new { htmlAttributes = new { @class = "form-control", @placeholder = "somente numeros" } })
@Html.ValidationMessageFor(model => model.preco, "", new { @class = "text-danger" })
</div>
</div>
Web.config:
<system.web>
<globalization culture="pt-BR" uiCulture="pt-BR" />
...
</system.web>
According to the question that was compared to duplicated, the solution of it unfortunately does not cover my question.
– Erico Souza
We’ll reopen, then I’ll answer to you.
– Leonel Sanches da Silva