@Html.HiddenFor does not work on Lists in ASP.NET MVC

后端 未结 13 936
灰色年华
灰色年华 2020-11-27 15:13

I\'m using a model that contains a List as a property. I\'m populating this list with items i grab from SQL Server. I want the List to be hidden in the view and passed to th

13条回答
  •  庸人自扰
    2020-11-27 15:31

    You can take a look on this solution.

    Put only HiddenFor inside the EditorTemplate.

    And in your View put this: @Html.EditorFor(model => model.MyList)

    It should works.

提交回复
热议问题