我想知道如何为文本框html元素添加更多属性
例如
@Html.TextBoxFor(model => model.DBFIELDFROMTABLE, "CustomTemplate", new { @class = "form-control"})
我想添加Maxlength
@Html.TextBoxFor(model => model.DBFIELDFROMTABLE, "CustomTemplate", new { @class = "form-control"})
答案 0 :(得分:0)
只需将另一项添加到Html属性对象即可。您可以按命令添加任意多个。
@Html.TextBoxFor(model => model.DBFIELDFROMTABLE, "CustomTemplate", new { @class = "form-control", maxlength = "10"})