【发布时间】:2017-09-18 19:32:37
【问题描述】:
在我的模型中,我使用属性。
[Display(Name = "Pensja")]
public decimal? Salary { get; set; }
在编辑 Razor 视图中,我想将值从 4000,00 更改为 4000,50。 在 View 中看起来像这样。
<div class="form-group">
@Html.LabelFor(model => model.Salary, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Salary, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Salary, "", new { @class = "text-danger" })
</div>
</div>
我收到消息说薪水必须是一个数字。我做错了什么?
【问题讨论】:
-
你使用 Html.BeginForm 吗?你如何在控制器上发送数据?请详细更新问题。
-
我使用 Html.BeginForm
-
此消息是客户端验证错误消息?
标签: c# entity-framework razor html-helper