Model binding with complex type
问题 I have made a test controller and view to test complex binding, but I can't seem to make it work. Here is my ViewModel: public class TestViewModel { public SubTest MainTest { get; set; } public List<SubTest> SubTestList { get; set; } } public class SubTest { public string Name { get; set; } public int Id { get; set; } } Here is my View: @model TestViewModel @{ using (Html.BeginForm()) { <h2>Main</h2> <p> @Html.DisplayTextFor(m => m.MainTest.Id) => @Html.DisplayTextFor(m => m.MainTest.Name) <