I have a razor view index that gets @model IEnumerable<Test.Models.Pet> collection from the controller. The model has 2 properties, ImageUrl and Name.
I build the view this way:
@for (int cnt=0;cnt<Model.Count();cnt++)
{
//string imageUrl = @Model.ElementAt(cnt).ImageUrl;
if (cnt == 0)
{
<div class="col span-1-of-4 box">
<h4>@Html.DisplayFor(model => model.ElementAt(cnt).Name)</h4>
<img src="WHAT GOES HERE" alt="@Html.DisplayFor(model => model.ElementAt(cnt).ImageUrl)" width="100" height="100" />
</div>
}
}
I can get the imageurl value in the alt attribute(just to see what I've returned), but can't figure out what to put in the src="" attribute. Please help.