If I understand your question, you probably want to do this:
@foreach(var permisionMag in Model.PermisionManagement) { <tr> <td rowspan="@permisionMag.TechnologyTypes.Count()">@permisionMag.Name</td> @{int i = 0; @foreach (var item in permisionMag.TechnologyTypes.OrderBy(a => a.Name)) { <td class="f"> @(i+1) @item.Name i = i + 1; </td> </tr> <tr> } </tr> } }
But it should essentially build you something like this:
---------------- | Name | Item1 | | | ----- | | | Item2 | | | ----- | | | Item3 | | | ----- | | | Item4 | ----------------
source share