开发者

ASP.NET MVC 2 - Setting id of Html.Form

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 i开发者_如何学Pythond 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" }))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜