How do I give a name to a form in ASP.NET MVC using Html.BeginForm()
? I want only the name, not the action or controller name because I want to post it through Javascript. I think it should be something like Html.BeginForm(id = "frm")
.
I tried the following:
Html.BeginForm(null,null,new{id="frm",name="frm})
Html.BeginForm(new{@id="frm",@name="frm})
But the above code produces output like this:
<form action="/Main/Index/Id?name=Id" method="post">