0

In my ASP.Net MVC razor app (which uses twitter bootstrap 3), I have a view used to display vaules (details view) as follows:

<div class="form-group">
    <div class="col-lg-3 control-label">
        @Html.LabelFor(model => model.ModelNo)
    </div>
    <div class="col-lg-9">
        @Model.ModelNo
    </div>
</div>
<div class="form-group">
    <div class="col-lg-3 control-label">
        @Html.LabelFor(model => model.SerialNo)
    </div>
    <div class="col-lg-9">
        @Model.SerialNo
    </div>
</div>
<div class="form-group">
    <div class="col-lg-3 control-label">
        @Html.LabelFor(model => model.DrawingNo)
    </div>
    <div class="col-lg-9">
        @Model.DrawingNo
    </div>
</div>
<div class="form-group">
    <div class="col-lg-3 control-label">
        @Html.LabelFor(model => model.Manufacturer)
    </div>
    <div class="col-lg-9">
        @Model.Manufacturer
    </div>
</div>
<div class="form-group">
    <div class="col-lg-3 control-label">
        @Html.LabelFor(model => model.MinorSubLocation)
    </div>
    <div class="col-lg-9">
        @Model.MinorSubLocation
    </div>
</div>
<div class="form-group">
    <div class="col-lg-3 control-label">
        @Html.LabelFor(model => model.EquipmentTypeId)
    </div>
    <div class="col-lg-9">
        @Model.EquipmentTypeName
    </div>
</div>

The layout works well EXCEPT when a value returned from the model is null. When that happens, the "form-group" div following it ends up on the same line. In the image below, the MinorSubLocation is null:

enter image description here

It pretty much messes of the layout after that. I am pulling my hair out trying to get this to work!

4

1 回答 1

2

您可以将课程添加row<div class="form-group">

<div class="form-group row">
于 2013-08-21T21:37:15.170 回答