Is my syntax wrong?
Yes, IEnumerable or ICollection do not have indexer: x.traces[i]
.
It would be better if you used a collection whose elements can be accessed by index such as IList<T>
or T[]
, depending on the concrete type of your view model.
Then you will be able to do this:
@model IList<MyViewModel>
...
@for (var i = 0; i < Model.traces.Count; i++)
{
@Html.EditorFor(x => x.traces[i].status)
}