I have a dynamic table like:
<tbody>
<% foreach (var item in Model)
{
%>
<tr>
......
</tr>
<% } %>
</tbody>
Then I want to change the row background color to different for neighbor row:
<tbody>
<% int i = 0;
foreach (var item in Model)
{
%>
<%if (i++ % 2 == 0)
{ %>
<tr style="background-color:Aqua">
<%} else { %>
<tr style="background-color:Fuchsia">
<%} %>
....
</tr>
<% } %>
</tbody>
But it doesn't work. Or anotther way like: <tr style="background-color:<%...%>">
, also not work. How to resolve this problem?