我有大約35個單選按鈕列表值將顯示在我的視圖中使用@ html.RadioButtonFor在.cshtml頁面中的html助手。如何在mvc4中水平和垂直對齊單選按鈕列表值?
我想顯示在9列和4行。
在使用類似「RepeatLayout」,「RepeatDirection」,「RepeatColumns」的控件屬性的Asp.net中,我們可以實現這一點。
我想將它應用於mvc4.Is是否有任何方法來實現相同的東西?
請幫忙!
控制器代碼:
ViewBag.Ratio = query.Select(m => new SelectListItem { Value = m.RatioID, Text = m.Ratio_Description });
.cshtml代碼
<td colspan="3" >
@foreach (var item in (IEnumerable<SelectListItem>)ViewBag.Ratio)
{
@Html.RadioButtonFor(m => m.RatioType, new { @item.Value, @item.Text })
<label for = "@item.Value">@item.Text</label>
}
</td>
您可以通過使用[第n個孩子()](http://www.w3schools.com/cssref/sel_nth-child.asp) – glautrou 2014-09-11 13:32:31
請粘貼代碼 – Jay 2014-09-11 13:35:46
周杰倫嗨,這是適應你的CSS我的代碼 – Himani 2014-09-12 08:54:01