ASP.NET MVC - Can't bind array to view model

后端 未结 3 876
甜味超标
甜味超标 2020-12-09 02:35

I have a view model with a from that includes a set of checkboxes. I need the check boxes to map to an array when binding in the post back method of my controller.

H

3条回答
  •  猫巷女王i
    2020-12-09 03:13

    Set the name of the input types to all be the same. You can also create a custom model binder if you are trying to bind a more complex model than just a list. Here is an excellent article on the different ways to bind to your models

    Various Model Binding techniques

提交回复
热议问题