【发布时间】:2019-06-29 05:55:47
【问题描述】:
当我的“Active”属性切换为 false 时,如何更改表格行的颜色?
我不使用表中的“Active”属性,因为它没有意义。那么我将如何检查该属性是否为 false 并更改表格的颜色?
我的视图模型
public class CodigosDeOperacaoViewModel
{
[Key]
public Guid Id { get; set; }
[Required(ErrorMessage ="Campo Obrigatório")]
[MaxLength(10)]
public string Code{ get; set; }
[Required(ErrorMessage = "Campo Obrigatório")]
public string Description{ get; set; }
[ScaffoldColumn(false)]
public bool Active{ get; set; }
}
我的视图
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Code)
</th>
<th>
@Html.DisplayNameFor(model => model.Description)
</th>
<th>Actions</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Code)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
</tr>
}
</table>
【问题讨论】:
标签: asp.net-mvc twitter-bootstrap razor