Html.BeginForm with html attributes asp.net mvc4
The Action and Controller parameters can also be null to use the default action:
Html.BeginForm( null, null, FormMethod.Post, new { id=”formname”, @class="formclass" })
The override you need is:
@using( Html.BeginForm("Edit", "Clients", new { Id=Model.Id},
FormMethod.Post, new { @class = "example" } ) )
{
}
- Route values like "id" are passed as the third parameter.
- HTML attributes like "class" are passed as the fifth parameter.
See MSDN docs.