ASP.Net MVC - model with collection not populating on postback

后端 未结 6 481
面向向阳花
面向向阳花 2020-12-01 19:08

I have an ASP.Net MVC application with a model which is several layers deep containing a collection.

I believe that the view to create the objects is all set up co

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 19:50

    Make sure your models (and all nested models) are using properties (getters/setters) instead of fields. Apparently the default binder needs properties to function properly. I had a very similar situation that was fixed by changing the necessary fields to properties.

提交回复
热议问题