Model view controller 我可以使DropDownList for width与TextBoxFor width与Bootstrap类相同吗?
我有一个新的客户观点:Model view controller 我可以使DropDownList for width与TextBoxFor width与Bootstrap类相同吗?,model-view-controller,view,width,dropdownlistfor,html.textboxfor,Model View Controller,View,Width,Dropdownlistfor,Html.textboxfor,我有一个新的客户观点: <table class="table"> <tr> <td class="text-right"> @Html.LabelFor(model => model.Customer.GenderId) </td> <td>
<table class="table">
<tr>
<td class="text-right">
@Html.LabelFor(model => model.Customer.GenderId)
</td>
<td>
@Html.DropDownListFor(model => model.Customer.GenderId,new SelectList(Model.Genders,"Id", "GenderType"),"-=Select Title=-")
</td>
</tr>
<tr>
<td class="text-right">
@Html.LabelFor(model => model.Customer.Name)
</td>
<td>
@Html.TextBoxFor(model => model.Customer.Name)
</td>
</tr>
</table>
@LabelFor(model=>model.Customer.GenderId)
@Html.DropDownListFor(model=>model.Customer.GenderId,新选择列表(model.Genders,“Id”,“GenderType”),“-=selecttitle=-”)
@LabelFor(model=>model.Customer.Name)
@Html.TextBoxFor(model=>model.Customer.Name)
我可以将宽度下拉列表和文本框与boostrap类对齐吗
我更改了代码:
<div class="form-horizontal">
<div class="form-group">
@Html.LabelFor(model => model.Customer.GenderId, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownListFor(model => model.Customer.GenderId, new SelectList(Model.Genders, "Id", "GenderType"), "Select Title", new { @class = "form-control " })
@Html.ValidationMessageFor(model => model.Customer.GenderId, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Customer.Name, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Customer.Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Customer.Name, "", new { @class = "text-danger" })
</div>
</div>
</div>
@LabelFor(model=>model.Customer.GenderId,htmlAttributes:new{@class=“controllabel col-md-2”})
@DropDownListFor(model=>model.Customer.GenderId,新选择列表(model.Genders,“Id”,“GenderType”),“选择标题”,新{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Customer.GenderId,“,新的{@class=“text danger”})
@LabelFor(model=>model.Customer.Name,htmlAttributes:new{@class=“controllabel col-md-2”})
@EditorFor(model=>model.Customer.Name,new{htmlAttributes=new{@class=“form control”}})
@Html.ValidationMessageFor(model=>model.Customer.Name,“,new{@class=“text danger”})