Last active
August 29, 2015 14:17
-
-
Save ech01/9afb339f32dd893b122b to your computer and use it in GitHub Desktop.
Handy way to output a different layout for every other item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
int rowCounter = 0; | |
} | |
<div> | |
@foreach(var e in (List)) { | |
var Content = e.Content; | |
rowCounter = rowCounter +1; | |
if (rowCounter % 2 == 0) | |
{ | |
<div class="media"> <div class="media-left"><img alt="@Content.Title" class="media-object" src="@Content.Picture" /></div> | |
<div class="media-body"> <h4 class="media-heading">@[email protected]</h4>@Html.Raw(Content.Text)</div> </div> | |
} | |
else { | |
<div class="media"><div class="media-body"> <h4 class="media-heading">@[email protected]</h4>@Html.Raw(Content.Text)</div> <div class="media-right"><img alt="@Content.Title" class="media-object" src="@Content.Picture" /></div> | |
</div> | |
} | |
} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment