<table> <% int count = Model.Count; int rowCount = count % 4 == 0 ? count / 4 : count / 4 + 1; for (int i = 0; i < rowCount; i++) { %> <tr> <%for (int j = 0; j < 4; j++) { %> <td> <% int index = i * 4 + j; if (index < count) { %> <%=Model[i * 4 + j]%> <% } %> </td> <%} %> </tr> <% } %> </table>