How do you set the id of an Html.Form in ASP.NET MVC 2?
I tried this:
<% using (Html.BeginForm("Save", "Clients", new { id = "SubmitForm" })) {%>
But it doesn't work, my form still doesn't have an id property:
<form action="/TothSolutions/Secure/Clients/Save/SubmitForm" method="post">
I'm guessing this worked in ASP.NET MVC 1 but not 2. The reason I need the id property set is so that I can do jQuery validation on the form: $("#myForm").validate etc...
Thanks, Justin
You are using the wrong overload. Use this one:
http://msdn.microsoft.com/en-us/library/dd492714.aspx
using (Html.BeginForm("Save", "Clients", FormMethod.Post,
new { id = "SubmitForm" }))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With