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

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

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 mvc? I am using this...

<% using (Html.BeginForm()) {%> 

and my jquery validator plugin takes this,

var validator = $("#signupform").validate({ 

Now i want to give id as signupform... Any suggestion...

Anonymous Type syntax in ASP.NET MVC


can hidden variables value be accessed in a controller in MVC
This should get the id added..
var javascript to MVC model
ASP.NET MVC 5 and lower:.
Route always goes to the first maproute
<% using (Html.BeginForm(null, null, FormMethod.Post, new { id = "signupform" }))    { } %> 
ASP.NET Core 1.0 MVC: You can use tag helpers to avoid the odd syntax for setting the id..
How to pass a delegate to create an expression tree that is a MethodCallExpression
<form asp-controller="Account" asp-action="Register" method="post" id="signupform" role="form"></form> 

Forms Authentication & IIS7 (&MVC): Why ReturnUrl=/ is added?

Can i access ValidationMessage through jquery in mvc


Internet Explorer Nested Form Post
In System.Web.Mvc.Html ( in System.Web.Mvc.dll ) the begin form is defined like:- Details.
BeginForm ( this HtmlHelper htmlHelper, string actionName, string
controllerName, object routeValues, FormMethod method, object htmlAttributes) .
Means you should use like this :.
Html.BeginForm( string actionName, string controllerName,object routeValues, FormMethod method, object htmlAttributes).
So, it worked in MVC 4.
@using (Html.BeginForm(null, null, new { @id = string.Empty }, FormMethod.Post,     new { @id = "signupform" })) {     <input id="TRAINER_LIST" name="TRAINER_LIST" type="hidden" value="">     <input type="submit" value="Create" id="btnSubmit" /> } 


I've added some code to my project, so it's more convenient.. HtmlExtensions.cs:.
namespace System.Web.Mvc.Html {     public static class HtmlExtensions     {         public static MvcForm BeginForm(this HtmlHelper htmlHelper, string formId)         {             return htmlHelper.BeginForm(null, null, FormMethod.Post, new { id = formId });         }          public static MvcForm BeginForm(this HtmlHelper htmlHelper, string formId, FormMethod method)         {             return htmlHelper.BeginForm(null, null, method, new { id = formId });         }     } } 
@using (Html.BeginForm("signupform"))  {     @* Some fields *@ } 

52 out of 100 based on 57 user ratings 432 reviews