Friday, 24 July 2015

Razor syntax is loop odd or even

I had to render a table of data today, and alternate classes on the rows. Here's the Razor:
tr class="@(rowCounter%2 == 0 ? "even" : "odd")"