Not sure if you want to increase the number of Item (or if @item.Name really contains an incremented number), but the following code will increase both the class name (new div every 4th iteration) and the position number.
@{ var t = 0; var i = 1; } <div class=" tab-@t "> @foreach (var item in Model.Items) { <a>Item @i</a> // this may be just @item.Name? if (i % 4 == 0) { t++; @:</div><div class="tab-"@t> } i++; } </div>
user3559349
source share