汇总汇总的MVC显示模板
本文关键字:MVC 显示 | 更新日期: 2023-09-27 18:01:02
我想在不在视图模型中创建特殊属性的情况下,在表页脚中显示汇总汇总。
但是。。。页脚代码失败,表示:
"模板只能与字段访问、属性访问、,一维数组索引或单参数自定义索引器表达式。">
足球代码看起来像:
<tfoot>
<tr>
<td colspan="6" class="bg-gray"></td>
</tr>
<tr>
<td colspan="2">
Totals DO NOT include Price Consessions
</td>
<td>
@Html.DisplayFor(modelItem => Model.Entities.Sum( x => x.Price))
</td>
<td>
@Html.DisplayFor(modelItem => Model.Entities.Sum(x => x.AnnualFee))
</td>
<td>
</td>
</tr>
</tfoot>
只需省略@Html.DisplayFor
并放入@Model.Entities.Sum( x => x.Price)