Given the following Razor code:
<tbody>
@foreach (Profession profession in Model)
{
<tr>
<td>@profession.Name</td>
<td>@profession.PluralName</td>
<td>@Html.ActionLink("Edit", "AddOrEdit", new { Id = profession.ProfessionID })</td>
</tr>
}
</tbody>
What's the simplest way to provide some kind of alternate row styling? (i.e. different styling for odd and even rows.)
I don't seem to be able to add arbitrary C# to declare a bool
variable which gets flipped each iteration of the foreach
loop in order to set a classname for the tr
, for example.