@model List<TestMVC4.Data.Country>
@{
ViewBag.Title = "SearchView";
}
<h2>SearchView</h2>
@{bool isalter = false;}
@{string className = "";}
<table style="width:60%">
<tr>
<th>Country ID</th>
<th>Country Name</th>
<th>View States</th>
</tr>
@foreach (var country in Model)
{
if(isalter)
{
className="FirstRow";
isalter=false;
}
else
{isalter=true;
className="SecondRow";
}
<tr class=@className>
<td>@country.CountryID</td>
<td>@country.CountryName</td>
<td>@Html.ActionLink("ViewStates", "redirect", new {countryCode=country.CountryID })</td>
</tr>
}
</table>