小编JKu*_*ufa的帖子

View model with complex type is null when passed to controller

I am trying to pass a view model with complex types to my controller. I have researched everything I can top to bottom over this subject and I am still confused.

The Problem:

When I click my submit button, the view model is passed in but the List of MacroInfo property is null.

UpdateIndexViewModel

public class UpdateIndexViewModel
{
    //This view model will become larger later
    public List<MacroInfo> MacrosToUpdate { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

MacroInfo

public class MacroInfo
{
    public bool …
Run Code Online (Sandbox Code Playgroud)

c# model-view-controller asp.net-mvc viewmodel razor

6
推荐指数
1
解决办法
76
查看次数