Search code examples
asp.net-mvchtml.beginform

Html.BeginForm and HTML Attributes w/o specifying Controller and Action


I like the cleanliness of

using (Html.BeginForm())

And hate that adding HTML attributes requires specifying the controller, action, and form method.

using (Html.BeginForm("Action", "Controller", FormMethod.Post,
  new { id = "inactivate-form" })

Is there a way to use Html.BeginForm and specify HTML attributes for the form without manually wiring everything else up?


Solution

  • Why would you not just use plain html?

    <form id="inactivate-form" method="post" >
    </form>