使用 EditorFor 模板并尝试创建一个表,我怎样才能只获得一个标题行,而不是为集合的每个项目获取一个标题行?
作为视图模型
public class CashbackOfferViewModel
{
public List<SingleCashbackOfferViewModel> Offers { get; set; }
}
在我看来
@Html.DisplayFor(m => m.Offers)
显示模板是
@using LMS.MVC.Infrastructure
@model LMS.MVC.Areas.Finance.Models.SingleCashbackOfferViewModel
<table class="dataGrid">
<thead>
<tr class="headerRow">
<th>@Html.LabelFor(m => m.CampaignName)</th>
<th>@Html.LabelFor(m => m.PersonId)</th>
<th>@Html.LabelFor(m => m.FullName)</ths>
</tr>
</thead>
<tbody>
<tr>
<td>@Html.DisplayFor(m => m.CampaignName)</td>
<td>@Html.DisplayFor(m => m.PersonId)</td>
<td>@Html.DisplayFor(m => m.FullName)</td>
</tr>
</tbody>
</table>