How to add ID property to Html.BeginForm() in asp.net mvc?

后端 未结 4 1130
慢半拍i
慢半拍i 2020-12-12 23:03

I want to validate my form using jquery but it doesn\'t have an ID property as of now how to add it to the form in asp.net mvc? I am using this...



        
4条回答
  •  渐次进展
    2020-12-12 23:40

    May be a bit late but in my case i had to put the id in the 2nd anonymous object. This is because the 1st one is for route values i.e the return Url.

    @using (Html.BeginForm("Login", "Account", new {  ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { id = "signupform", role = "form" }))
    

    Hope this can help somebody :)

提交回复
热议问题