Reputation: 309
I am new to MVC.
How I can add id and css class in MVC Html.BeginForm().
This is html form.
<form id="frmId" class="frmStyle">
...
</form>
I tried this but got error.
@Html.BeginForm("actionName", "controllerName", new {id="frmId", class = "frmStyle"})
Upvotes: 16
Views: 35998
Reputation: 7525
We add as part of htmlAttributes.
@Html.BeginForm("actionName", "controllerName", FormMethod.Post,
new {id="frmId", @class = "frmStyle"})
Upvotes: 36