【发布时间】:2015-06-10 02:03:42
【问题描述】:
在我的 MVC 视图中,我在表格中显示来自我的模型的数据列表,如下所示。当我的 if-else 语句中的某个字段满足特定条件时,如何使指定的行更改颜色?似乎我不能在我的 if-else 中添加一个 jquery...
我的观点:
...
<table>
...
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.field1)
</td>
<td>
@Html.DisplayFor(modelItem => item.field2)
</td>
<td>
@if(item.field3== 0){
//change this row to grey color
}
else {
@Html.DisplayFor(modelItem => item.field3)
}
</td>
....
</table>
【问题讨论】:
标签: asp.net-mvc if-statement html-table asp.net-mvc-views