我是 MVC 的新手。
如何在 MVC Html.BeginForm() 中添加 id 和 css 类。
这是 html 表单。
<form id="frmId" class="frmStyle">
...
</form>
我试过这个,但有错误。
@Html.BeginForm("actionName", "controllerName", new {id="frmId", class = "frmStyle"})
最佳答案
我们添加为 htmlAttributes 的一部分。
@Html.BeginForm("actionName", "controllerName", FormMethod.Post,
new {id="frmId", @class = "frmStyle"})
关于asp.net - MVC 在 MVC Html.BeginForm() 中添加 id 和 css 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23063162/