Hi I am new to MVC and I am trying to make a table that shows alternate colour rows. Something like this:
@foreach (var item in Model) {
var result = "";
var styleWhite = @"style=""background-color:white""";
var styleBlue = @"style=""background-color:blue""";
if ( (item.ID % 1) == 0 )
{ result = styleBlue; }
else
{ result = styleWhite; }
<tr @result >
<td>
@Html.DisplayFor(modelItem => item.CALLTYPE)
</td>
<td>
@Html.DisplayFor(modelItem => item.DESCRIPTION)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
However the double quote keeps rendering as ""e" like this:
<tr style="background-color:blue" >
Is there a way to suppress the rendering and get the double quote (or single quote) inside the tag? Thanks for any assistance.