【发布时间】:2014-09-12 18:08:40
【问题描述】:
我有大约 35 个单选按钮列表值要显示在我的视图中,使用 .cshtml 页面中的 @html.RadioButtonFor html 助手。
我想显示为 9 列 4 行。
在 Asp.net 中使用“RepeatLayout”、“RepeatDirection”、“RepeatColumns”等控件属性,我们可以实现这一点。
我想将它应用于 mvc4。有什么方法可以实现吗?
请帮忙!
控制器代码:
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>
【问题讨论】:
-
你可以使用nth-child()调整你的CSS
-
请粘贴您的代码
-
嗨,Jay,这是我的代码
标签: c# css asp.net-mvc-4