I think the extra <tr>
after your if
statement might be causing the browser to ignore your html, as the html would actually be broken with two <tr>
tags being rendered.
I would probably update the code to be more like;
@{ bool IsFirst = true; }
@foreach (DxRow r in Model)
{
<tr class="@( IsFirst ? "success" : "")">
<td>@r.dxCode</td>
<td>@r.dxDescription</td>
<td>@r.dxDate</td>
<td>@r.dxType</td>
<td>
<span class='up'><i class='icon-arrow-up bigger-160' style='color:green'></i></span>
<span class='down'><i class='icon-arrow-down bigger-160' style='color:red'></i></span>
<span class='top'><i class='icon-star bigger-160' style='color:goldenrod'></i></span>
<span class='delete'><i class='icon-trash bigger-160' style='color:red'></i></span>
</td>
</tr>
IsFirst = false;
}
Since you are setting IsFalse
to false after the first loop. Makes the code tidier.