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

本文关键字:编辑器 复选框 显示 | 更新日期: 2023-09-27 18:07:17

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

<

编辑模板/strong>

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

视图/strong>

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

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

try this

<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>