The field must be a number

前端 未结 4 2136
死守一世寂寞
死守一世寂寞 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:02

    You may want to decorate your field with the [DisplayFormat] attribute as bellow:

    [DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)]
    public decimal Price { get; set; }
    

提交回复
热议问题