The easiest way to do this is to simply add the "SelectedItem" property to your model:
public class YourModel { public IEnumberable<Item> YourCollection { get; } public Item SelctedItem { get; set; } }
Then simply assign each item in the list to the selctedItem property:
<% foreach (var item in Model.YourCollection) { %> Model.SelctedItem = item; <%= html.EditorFor(SelctedItem) %> ... <% } %>
source share