输入字段不应用bootstrap

时间:2017-07-24 10:20:40

标签: twitter-bootstrap

我的输入字段没有应用引导程序样式,但我的下拉列表没有。我的代码如下。我在这里使用局部视图。

@model SMC_AMS.Models.ViewModel.UserSignUpView

<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Registration</h1>
        @using (Html.BeginForm())
        {
            @Html.AntiForgeryToken()

            <div class="form-horizontal">
                <h4>Signup</h4>
                <hr />
                @Html.ValidationSummary(true)

                <div class="form-group">
                    @Html.LabelFor(model => model.LoginName, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.LoginName)
                        @Html.ValidationMessageFor(model => model.LoginName)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Password, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.Password)
                        @Html.ValidationMessageFor(model => model.Password)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.FirstName)
                        @Html.ValidationMessageFor(model => model.FirstName)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.LastName)
                        @Html.ValidationMessageFor(model => model.LastName)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Gender, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-2">
                        @Html.DropDownListFor(model => model.Gender, new List<SelectListItem>
                         {
                             new SelectListItem {Text = "Male", Value = "M"},
                             new SelectListItem {Text = "Female", Value = "F"}
                         }, new { @class = "form-control" })
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                        <input type="submit" value="Create" class="btn btn-default" />
                    </div>
                </div>
            </div>
        }

        <div>
            @Html.ActionLink("Back to Main", "Index", "Home", null, new { @class = "btn btn-primary" })
        </div>
</div>

<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

请你指点我正确的方向。

1 个答案:

答案 0 :(得分:0)

万一有人想知道,我刚刚改变了#34; EditorFor&#34;到&#34; TextboxFor&#34;

 <div class="form-group">
                @Html.LabelFor(model => model.LoginName, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.LoginName)
                    @Html.ValidationMessageFor(model => model.LoginName)
                </div>
            </div>