I am doing a simple for loop in Razor syntax in MVC:
@for (int i = 0; i < Model.ProductViewModels.Count; i++)
{
if (i%2 == 0)
{
<div class="row">
}
<div class="col-md-4">
<a href="/product?id=@Model.ProductViewModels[i].Id">@Model.ProductViewModels[i].Title - @Model.ProductViewModels[i].Isbn13
<br />
<img src="@Model.ProductViewModels[i].ImageUrl" />
</a>
</div>
@if (i%2 == 0)
{
</div>
}
}
This seems like pretty legal code in my mine mind, but it isn't working!
I get the error:
Meddelelse om parserfejl: The for block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.
Screenshot of error:
Any ideas? :) Thanks