I\'m writing my first MVC3 application which is a simple order tracking application. I would like to edit the order and the details at the same time. When I edit the order t
The issue is with your foreach if you look at the raw html that it produces it will not be generating unique ids for each of the order lines and thus will not be able to bind the model when the form is posted back.
Change the foreach to a for loop and then reference each orderline using the index. This will allow for unique ids to be generated in the form and allow you to bind the to the model when it is posted back.
e.g.
@for (var counter = 0; counter < Model.OrderLines.Count(); counter++)
{
@Html.EditorFor(modelItem => Model.OrderLines[counter].Description)
@Html.EditorFor(modelItem => Model.OrderLines[counter].Quantity)
@Html.EditorFor(modelItem => Model.OrderLines[counter].Weight)
@Html.EditorFor(modelItem => Model.OrderLines[counter].Price)
}