I'm having problems with monetary value in my Asp.Net MVC application and would like to know how to configure
In class
[Display(Name = "Valor Produto")]
[Required(ErrorMessage = "O campo {0} é obrigatório")]
[DataType(DataType.Currency)]
public float AnuncioValorProduto { get; set; }
In View I switched to TexBoxFor
<div class="form-group">
@Html.LabelFor(model => model.AnuncioValorProduto, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.AnuncioValorProduto, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.AnuncioValorProduto, "", new { @class = "text-danger" })
</div>
</div>
I downloaded the script jquery-maskmoney
I put the scripts in the folder and added them to the BunddleConfig.cs
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*",
"~/Scripts/jquery.maskMoney.js"));
And you're giving the following error as pictured below
And I initialized the comapo with jquery according to documentation
<script>
$(function () {
$('#AnuncioValorProduto').maskMoney();
});
</script>