title: How we can divide row in 3 columns in foreach loop
body: <p>I want to divide a row into 3 columns in a foreach loop using asp.net mvc core </p>
  
  <p><strong>This is my code</strong></p>
  
  <pre><code>@foreach (var item in Model)
  {
      &lt;div class="container"&gt;
          &lt;h3 class="h3"&gt;Products&lt;/h3&gt;
          &lt;div class="row"&gt;
              &lt;div class="col-md-4 col-lg-3"&gt;
                  &lt;div class="product-grid2"&gt;
                      &lt;div class="product-image2"&gt;
                          &lt;a href="#"&gt;
                              &lt;img class="pic-1" src="http://bestjquery.com/tutorial/product-grid/demo3/images/img-2.jpeg"&gt;
                              &lt;img class="pic-2" src="http://bestjquery.com/tutorial/product-grid/demo3/images/img-2.jpeg"&gt;
                          &lt;/a&gt;
                          &lt;ul class="social"&gt;
                              &lt;li&gt;&lt;a href="#" data-tip="Quick View"&gt;&lt;i class="fa fa-eye"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href="#" data-tip="Add to Wishlist"&gt;&lt;i class="fa fa-shopping-bag"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href="#" data-tip="Add to Cart"&gt;&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;/ul&gt;
                          &lt;a class="add-to-cart" href=""&gt;Add to cart&lt;/a&gt;
                      &lt;/div&gt;
                      &lt;div class="product-content"&gt;
                          &lt;h3 class="title"&gt;&lt;a href="#"&gt;Women's Designer Top&lt;/a&gt;&lt;/h3&gt;
                          &lt;span class="price"&gt;$599.99&lt;/span&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>Here's the output </p>
  
  <p><a href="https://i.stack.imgur.com/5p69D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5p69D.png" alt="enter image description here"></a></p>
  
  <p>I would like to move that 2nd product into the  2nd column of the first row</p>
  
  <p>Anu ideas?</p>