I have a View with a table representing an employee\'s timesheet. Days across the top, projects down the side, with each day/project intersection containing two values for regul
I eventually figured out why DefaultModelBinder
wasn't picking up on the properties of WorkUnit
: Because they weren't properties, they were fields. DefaultModelBinder
only works with properties. Changing the class definition of WorkUnit
and Project
to use fields made everything click:
public class Project {
public IList WorkUnits { get; set; }
public string Name { get; set; }
}
public class WorkUnit {
public DateTime Date { get; set; }
public decimal RegularHours { get; set; }
public decimal OvertimeHours { get; set; }
}
(Note: The source code in the original question had Project.Name defined as a field, in my actual code it was a property. This is why the Projects list was getting populated but WorkUnits wasn't.)