我的 foreach 代码
请注意,我的第二行具有不同的背景颜色。
@foreach (var item in Model.fNameList)
{
<tr>
<td style ="background-color:#E0EBEB; height:40px;width:100px;"><a href ="#" onclick='call();' style ="text-decoration:none; text-decoration-color:black;"> T-00001</a></td>
<td style ="background-color:#E0EBEB; height:40px;width:200px;"> @item.firstName</td>
</tr>
<tr>
<td style ="background-color:#fff; height:40px;width:100px;"><a href ="#" onclick="call();" style ="text-decoration:none; text-decoration-color:black;"> T-00001</a></td>
<td style ="background-color:#fff; height:40px;width:200px;"> @item.firstName</td>
</tr>
}
我希望我的第二个TR标签具有我的“FIRSTNAME”的第二个值,例如:如果var item[0]是"FIRSTNAME" = "GEM",并且var item[1]是"FIRSTNAME" = "DIAMOND"。现在,如果我运行我的代码,我的第一个TR标签的值是“FIRSTNAME”= “GEM”,而在第二个TR标签中,值也是“FIRSTNAME”=“GEM”。现在我希望我的第二个TR标签具有值:"FIRSTNAME" = "DIAMOND"。