编辑器模板在表格中显示复选框

时间:2013-04-04 08:48:43

标签: c# asp.net-mvc asp.net-mvc-3 mvc-editor-templates

我有一个编辑器模板,在表格中显示复选框。使用下面的代码,所有复选框都将呈现在一行上。任何人都可以建议如何每行渲染三个复选框吗?

编辑模板

@model AssignedBusAreaData
@using MOC.ViewModels

<td>
    @Html.HiddenFor(model => model.BusinessAreaID)    
    @Html.CheckBoxFor(model => model.Assigned)
    @Html.DisplayFor(model => model.BusinessAreaName)
</td>

查看

    <div class="editor-label">
        @Html.LabelFor(model => model.BusinessAreas)
    </div>
    <div class="editor-field">
        <table>
            <tr>
                @Html.EditorFor(model => model.BusinessAreas)
            </tr>
        </table>
    </div>

1 个答案:

答案 0 :(得分:1)

试试这个

<table>
  <tr>
   <td>
    @Html.HiddenFor(model => model.BusinessAreaID)    
    @Html.CheckBoxFor(model => model.Assigned)
    @Html.DisplayFor(model => model.BusinessAreaName)
   </td>
 </tr>
</table>

查看

<div class="editor-label">
    @Html.LabelFor(model => model.BusinessAreas)
</div>
<div class="editor-field">
    <table>
        <tr>
          <td>
            @Html.EditorFor(model => model.BusinessAreas)
          </td>
        </tr>
    </table>
</div>
相关问题