在Stackoverflow上,我找到带有以下标签的复选框的解决方案:
<div class="checkbox">
<label>@Html.CheckBoxFor(x => item.IsSelected) @Html.DisplayNameFor(x => item.IsSelected)</label>
</div>
Also, it's recomended solution on bootstrap but, how to set few checkbox in the same class and to set them in-line...
我尝试了类似的方法,但是,obvios只是垂直设置了复选框...
<div class="checkbox">
<label>@Html.CheckBoxFor(x => x.Temperature) @Html.DisplayNameFor(x => x.Temperature)</label>
</div>
<div class="checkbox">
<label>@Html.CheckBoxFor(x => x.Pressure) @Html.DisplayNameFor(x => x.Pressure)</label>
</div>
<div class="checkbox">
<label>@Html.CheckBoxFor(x => x.Humidity) @Html.DisplayNameFor(x => x.Humidity)</label>
</div>
<div class="checkbox">
<label>@Html.CheckBoxFor(x => x.TemperatureLocal) @Html.DisplayNameFor(x => x.TemperatureLocal)</label>
</div>
<div class="checkbox">
<label>@Html.CheckBoxFor(x => x.HumidityLocal) @Html.DisplayNameFor(x => x.HumidityLocal)</label>
</div>
<div class="checkbox">
<label>@Html.CheckBoxFor(x => x.CO2) @Html.DisplayNameFor(x => x.CO2)</label>
</div>
<div class="checkbox">
<label>@Html.CheckBoxFor(x => x.Illumination) @Html.DisplayNameFor(x => x.Illumination)</label>
</div>