razor foreach item in model code example
Example 1: cshtml foreach
@foreach (var item in Model.Foos)
{
<div>@item.Bar</div>
}
Example 2: 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>
}