【发布时间】:2014-08-23 05:05:04
【问题描述】:
我正在尝试在 razor 中创建一个水平表单,但我似乎无法应用 css。其他所有内容都有正确的 CSS,但是当我尝试将类添加到 BeginForm 甚至正常时,它不起作用。
这是我的看法:
@using (Html.BeginForm(Html.BeginForm("Default", "Employee", null, FormMethod.Post, new { @class = "form-horizontal" })))
{
<h2>Employee Search</h2>
<fieldset>
<div class="form-group">
@Html.Label("Company: ", new { @class = "control-label" })
</div>
<div>
@Html.DropDownList("cono", (List<SelectListItem>)ViewBag.CompanyList, new { @class = "form-control" })
</div>
<div class="form-group">
@Html.Label("First Name: ", new { @class = "control-label" })
</div>
<div>
@Html.TextBox("firstName", Session["firstname"], new { @class = "form-control" })
</div>
<div class="form-group">
@Html.Label("Last Name: ", new { @class = "control-label" })
</div>
<div>
@Html.TextBox("lastName", Session["lastname"], new { @class = "form-control" })
</div>
<div class="form-group">
@Html.Label("Branch: ", new { @class = "control-label" })
</div>
<div>
@Html.DropDownList("branch", (List<SelectListItem>)ViewBag.BranchList, new { @class = "form-control" })
</div>
<div class="form-group">
@Html.Label("Sales Rep: ", new { @class = "control-label" })
@Html.TextBox("salesRep", Session["salesrep"], new { @class = "form-control" })
</div>
<div class="form-group">
@Html.Label("Status Type: ", new { @class = "control-label" })
@Html.DropDownList("statusType", (List<SelectListItem>)ViewBag.StatusTypeList, new { @class = "form-control" })
</div>
</fieldset>
<input type="submit" class="btn btn-default" name="DefaultPost" value="Search" />
<input type="button" value="Clear" class="btn btn-default" onclick="location.href='@Url.Action("Default", "Employee")' " />
}
这是它的样子:
【问题讨论】:
标签: html css asp.net-mvc twitter-bootstrap razor