【.NET Core已取消】Html.BeginForm()
该方法用于构建一个From表单的开始,他的构造方法为:Html.BeginForm("ActionName", "ControllerName", FormMethod.method);
表单结构using(Html.BeginForm ("Login","Account",FormMethod.Post, new { @class = "form-horizontal", role = "form" } ) ){ } :
它将在客户端产生一个<form action="/Account/Login" method="post" class="form-horizontal" role="form"></form>标签;
- Text:@Html.TextBoxFor(model => Model.Name, new{@style = " 50px;", @class= "input"});
- 单选:@Html.RadioButtonFor(model => Model.Sex, "男", new { @name = "optionsRadios", @id = "optionsRadios1" });