title: How properly generate bootstrap grid via loop using Razor?
body: <p>I use ASP.NET MVC and bootstrap. I have many objects (>2) in collection and for each need a <code>&lt;div class="col-xs-6"&gt;</code> but with only 2 cols in a row. How to achive this using loop?
  There is 1 way but I am looking for something better:</p>
  
  <pre><code>@model List&lt;Object&gt;
  @using (Html.BeginForm("ActionName", "ControllerName"))
  {
      &lt;div class="row"&gt;
      @for (int i = 0; i &lt; Model.Count; i++)
      {
          if (i % 2 != 0) {
          &lt;div class="row"&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.TextBoxFor(o =&gt; o[i].Value)
              &lt;/div&gt;
          &lt;/div&gt;
          } else {
              &lt;div class="col-xs-6"&gt;
              @Html.TextBoxFor(o =&gt; o[i].Value)
              &lt;/div&gt;
          }
      }
      &lt;/div&gt;
  }
  </code></pre>