Skip to content

Instantly share code, notes, and snippets.

@ncarandini
Last active April 9, 2020 23:39
Show Gist options
  • Save ncarandini/02a93222bf71add1f5b2d1e2fae6faae to your computer and use it in GitHub Desktop.
Save ncarandini/02a93222bf71add1f5b2d1e2fae6faae to your computer and use it in GitHub Desktop.
A double for cycle to solve
@page "/MyPage"
<h3>Show images</h3>
@for (int i = 0; i < LabImages.Count; i += imagesPerRow)
{
<div class="card-deck">
@for(int j = i; j < i + imagesPerRow && j < LabImages.Count; j++)
{
<div class="card">
<img class="card-img-top" src="..." alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Title</h5>
<p class="card-text">Bytes: Length</p>
</div>
</div>
}
</div>
}
@code{
private int imagesPerRow = 4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment