I have a model:
public class MyListModel
{
public int ID {get;set;}
public List<User> Users{get;set;}
}
How do I use the Html.EditorFor method inside a foreach?
@model MyListModel
<table>
<tr>
<th></th>
</tr>
@foreach (var item in Model.Users) {
<tr>
<td>
@Html.EditorFor(item.Enabled)
</td>
</tr>
}
</table>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…