【发布时间】:2018-05-13 16:03:30
【问题描述】:
这对我来说没有意义。我正在尝试在我的 MVC5 项目中显示一个带有 4 个输入字段的表单。当我不使用 @using (HTML.BeginForm(...){..}
@using (Html.BeginForm("Create", "HR", FormMethod.Post)) {
但是一旦我输入@using (HTML.BeginForm(..) 语句,那么显示如下所示:
我的 html 助手哪里出错了?
这是我正在使用的一些示例 html 辅助方法..
<div class="panel-group">
<div class="panel panel-primary">
<div class="panel-heading"><h4>Create New Employee</h4></div>
<div class="panel-body">
<form class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2">First Name</label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.FirstName, new { @class = "form-control", placeholder = "Enter First Name" })
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Middle Name</label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.MiddleName, new { @class = "form-control", placeholder = "Enter Middle Name" })
</div>
</div>
</form>
</div>
</div>
【问题讨论】:
-
您是指
Html.BeginForm()和<form class="form-horizontal">(无效的html)还是<form class="form-horizontal">? -
是的,如果我删除了
标签: css asp.net-mvc-5 bootstrap-4