向 Html.BeginForm()添加 CSS 类

如何为以下情况添加 class 属性(仅使用 return nUrl) :

@using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl }))
{
}

我想要这样的东西:

@using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl }, new { @class = "login-form" }))
{
}
95579 次浏览

There is an overload for that, if you supply the controller action, name, and form method.

@using (Html.BeginForm("ActionName", "ControllerName",
new { ReturnUrl = ViewBag.ReturnUrl },
FormMethod.Post, new { @class="login-form" }))
{
etc.
}

Or simply using html :

<form action="/ActionName/ControllerName" method="post" class="login-form">


</form>
Html.BeginForm("Index", "EIApplication", FormMethod.Post, new { enctype = "multipart/form-data", **@class = "nea-forms"** })