I have a json with some objects. Using @foreach from Razor, I want to expose the results on a template, along with some filters that will filter my results.
The problem is that I can't render the template correctly. I want my sidebar/widget to be rendered one time one the right, and the results to be rendered one bellow another, and to look as you'd expect.
CODE:
@{int i = 0;}
@{
var client = new WebClient();
var json = client.DownloadString("http://example.com/raw/a5N8mJ2Y");
var results = Json.Decode(json);
}
<div class="container">
<div class="row">
@foreach (var result in results)
{
i++;
if (i == 2)
{
<!-- Left sidebar goes here -->
<aside id="sidebar" class="col-sm-3">
<section id="filters">
<h3>Filtre</h3>
...
</section>
</aside>
}
<div style="border-style: groove; " class="col-sm-9">
<!-- objects from json go here -->
</div>
}
</div>
</div>
Screenshot:
