write c# code inside foreach loop in mvc view code example
Example: cshtml foreach display
@for (int i=0; i < Model.allemp.Count;i++)
{
<tr>
<td>@Html.Label(Model.allemp[i])</td>
<td>@Html.Label(Model.alldept[i])</td>
</tr>
}
@for (int i=0; i < Model.allemp.Count;i++)
{
<tr>
<td>@Html.Label(Model.allemp[i])</td>
<td>@Html.Label(Model.alldept[i])</td>
</tr>
}