The field must be a number

前端 未结 4 2135
死守一世寂寞
死守一世寂寞 2021-02-19 08:32

I have this field:

public decimal Price { get; set; } in Database it is decimal (7,2).

View:

 @Html.EditorFor(model => model.Pric         


        
4条回答
  •  眼角桃花
    2021-02-19 09:09

    You might find your answer here error with decimal in mvc3 - the value is not valid for field , it didn't work for me so i used this temporary

    @{ Html.EnableClientValidation(false); } @Html.EditorFor(model => model.DecimalValue, new { htmlAttributes = new { @class = "form-control" } }) @{ Html.EnableClientValidation(true); } @Html.ValidationMessageFor(model => model.DecimalValue, "", new { @class = "text-danger" })

    and i find this here ASP .NET MVC Disable Client Side Validation at Per-Field Level

提交回复
热议问题