我研究了我可以使用的不同方法
@using (Html.BeginForm())
但我还是很困惑。我想要做的是为它提供一个类名,这样我就可以设置我自己的参数。
另外,我想为这些提供一个类:
@Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.")
@Html.ValidationMessageFor(m => m.Login.UserName)
这个是可能的吗?
发布于 2011-08-02 17:04:40
是:
@Html.BeginForm("Index", "Home", FormMethod.Post, new { @class = "myClass" })
和
@Html.ValidationMessageFor(m => m.Login.UserName, "Validation message", new { @class = "myOtherClass" })
您还可以执行以下操作:
@Html.BeginForm(htmlAttributes: new { @class = "myClass" })
https://stackoverflow.com/questions/6909580
复制相似问题