title: Razor Syntax Inline Code
body: <p>What i want to do is that, there is a div containing icon sets but i want make a row with 5 icons per row. So i wrote something like this.</p>
  
  <pre><code>&lt;div id="icons-list1" class="icons-list"&gt;
      @{ int catCount = 0; }
      @foreach (var catItem in Model.Categories)
      {
          if (catCount == 0)
          {
             &lt;div class="icons-list-row"&gt;
          }
          &lt;label title="@catItem.Name" data-selected-color="#@catItem.ColorCode" data-position="n" class="icon static big tooltip" original-title="Tooltip Title"&gt;
              &lt;img alt="@catItem.Name" src="@Url.Content(@BonubonUrlHelper.CategoryImages + "dark/music.png")"&gt;
              &lt;input name="categories" value="@catItem.Id" type="checkbox" /&gt;
          &lt;/label&gt;
          catCount++;
          @if (catCount == 5)
          {
              &lt;/div&gt;
              catCount = 0;  
          }
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>But i got an error, saying foreach statement has no ending block. I tried everything, but i couldn't manage to make it work. What i make wrong? I'm new to razor syntax.</p>
  
  <p>Thanks</p>