MVC 5 Razorを使用して編集フォームをデザインしています。私は入力コントロールが図のように全体の空白の幅を埋めるようにしたいが、うまくいきません。ここのイメージを参照してください。 Page hereMVC 5 @ Html.EditorFor widthを変更するには
私はコントロールをテーブルの寸法に入れました。 1つのディメンションはラベル用で、もう1つのディメンションは入力エディタ(HTMLヘルパ)用です。
私は、次のCSSクラスとフォームコントロールの幅を上書きしようとしたが、成功しません:
.form-control {
width: 100%!important;
}
もが別のCSSクラス
.newinputwidth {
width: 400px!important;
}
をしたが、それは幅を変更しません。入力の。
完全なMVCコードはこちらです。
@model test2.Models.CaseReport
<style>
.form-control {
width: 100%!important;
}
.newinputwidth {
width: 400px!important;
}
</style>
<h2>Edit</h2>
<div class="container">
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="row">
<div class="col-lg-12 col-md-12 col-xs-12">
<table id="dt" class="table table-condensed table-responsive table-bordered" width="100%" cellspacing="0">
<tr>
<td>Main Id</td>
<td>
@Html.EditorFor(model => model.CaseReportId, new { htmlAttributes = new { @class = "newinputwidth" } })
</td>
</tr>
<tr>
<td>Location</td>
<td>
@Html.EditorFor(model => model.Location, new { htmlAttributes = new { @class = "form-control" } })
</td>
</tr>
<tr>
<td>Disease </td>
<td>
@Html.EditorFor(model => model.ReportDate, new { htmlAttributes = new { @class = "form-control" } })
</td>
</tr>
</table>
</div>
<div class="row col-lg-12 col-md-12 col-xs-12 text-center">
<div>
<div>
@Html.Action("_DetailsIndex", new { id = Model.CaseReportId })
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
<div>
@Html.ActionLink("Back to List", "Index")
</div>
</div>
}
</div>