我尝试将id添加到文本框但得到错误。我应该使用Html.EditorFor()
声明。请咨询。
我的代码:
@Html.EditorFor(model => model.Historicals.HistoricalName, new { htmlAttributes = new { @class = "form-control" } }, new { id = "Historical_place_name" })
答案 0 :(得分:1)
我相信你应该将id属性添加到html属性。
@Html.EditorFor(m => m.Historicals.HistoricalName,
new { htmlAttributes = new { @class = "form-control", id = "Historical_place_name" } });