You nearly have it.
In this EditorTemplates\Option.cshtml
add the following:
@model IEnumerable<Option>
@foreach(var option in Model)
{
@Html.TextBoxFor(m => option.Text)
}
Then call it in your view like this:
@Html.EditorFor(model => model.Options)
If you are not populating your options on the initial get, you will need to add this in your ItemViewModel class:
public class ItemViewModel
{
public ItemViewModel()
{
Options = new List<Option>();
}
public int itemId { get; set; }
[UIHint("Option")]
public List<Option> Options { get; set; }
}
This constructor initializes the collection:
public ItemViewModel()
{
Options = new List<Options>();
}