MVC 4 ViewModel not being sent back to Controller

后端 未结 9 1797
感情败类
感情败类 2020-12-08 07:17

I can\'t seem to figure out how to send back the entire ViewModel to the controller to the \'Validate and Save\' function.

Here is my controller:

[H         


        
9条回答
  •  我在风中等你
    2020-12-08 07:44

    Try to loop with the folowing statement not with FOREACH

    
        @for (var i = 0; i < Model.itemlist.Count; i++)
        {
            
        }
    
    @Html.HiddenFor(x => x.itemlist[i].Id) @Html.HiddenFor(x => x.itemlist[i].Name) @Html.DisplayFor(x => x.itemlist[i].Name)

提交回复
热议问题