 <p>would this work:</p> <pre><code>&lt;table&gt; @for (int i = 0; i &lt;= Model.checkItems.Count; i++) { if (i % 6 == 0) { &lt;tr&gt; &lt;td&gt; &lt;input type="checkbox" id="chk_@(Model.checkItems[i].DisplayText)" name="chk" nameVal = "@Model.checkItems[i].DisplayText" value="@Model.checkItems[i].Value"/&gt; &lt;label for="chkGroup_@(Model.checkItems[i].DisplayText)"&gt;@Model.checkItems[i].DisplayText &lt;/td&gt; &lt;/tr&gt; } } &lt;/table&gt; </code></pre>