ASP.NET MVC bind array in model

后端 未结 1 1565
故里飘歌
故里飘歌 2020-12-18 17:57

This is somewhat a two-part question (please let me know if they should be split up).

1) I have a model class with an array of objects contained inside it. I would l

相关标签:
1条回答
  • Check out this article by Phil Haack : Model Binding To a List. It explains exactly what you need to do to bind to list properties, or properties that are complex objects.

    Essentially you just have to construct your POST data in the correct way for the model binder to parse it. The article explains how to add hidden index fields and represent your complex properties in your form.

    0 讨论(0)
提交回复
热议问题