Phil Haack has an article that describes how to set things up so the default model binder will bind to a collection on a post back:
http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx
The problem I am having is I am not just trying to send a collection back to the Controller action, but a ViewModel with a collection.
I have a class that basically looks like this:
public class MyViewModel
{
public int IncidentNumber { get; set; }
public string StoreId { get; set; }
public string RepId { get; set; }
public string OrderStatus { get; set; }
public CustomerViewModel Customer { get; set;
//... other properties and SelectLists for binding
public IEnumerable<OrderItemViewModel> OrderItemViewModels { get; set; }
I can actually get the CustomerViewModel data back on a postback, but the list of OrderItemViewModels is empty. How do I get those back? Phil's article isn't helping there.