I am working on an order form. The page loads the previously saved order items into a table. The first row of the table is the add new item row with Html.EditoFor() like this:
@Html.EditorFor(m => m.OrderItems[0].Description)
Of course the [0] represents in this case nothing, this is just to demonstrate the goal. To show the existing items, a for loop is used:
for (int i = 1; i < Model.OrderItems.Count; i++)
{ @Html.EditorFor(d => d.OrderItems[i].Description)}
The order items are stored in an IEnumerable list with four properties (Desc, Partnum, Cost, Qty).
The question is: the editor row is a form and when the user presses the Add button on the page how can that form add the new item to the existing list?