0
我尝试将id添加到文本框但出现错误。我应该使用Html.EditorFor()
声明。请咨询。如何使用Html.EditorFor语句将id添加到文本框?
我的代码:
@Html.EditorFor(model => model.Historicals.HistoricalName, new { htmlAttributes = new { @class = "form-control" } }, new { id = "Historical_place_name" })
它需要是'@ Html.EditorFor(M => m.Historicals.HistoricalName,新的{htmlAttributes =新{@class = “形式控制”,ID = “Historical_place_name”}})' –
但是使用'EditorFor()'方法已经添加的'id'有什么问题? (这是'id =“Historicals_HistoricalName”') –
谢谢。它解决了 – programmer138200