Bind Checkboxes to int array/enumerable in MVC

后端 未结 3 1619
慢半拍i
慢半拍i 2021-02-05 08:46
@Html.CheckBox(\"orderNumbers\", new { value = 1 })
@Html.CheckBox(\"orderNumbers\", new { value = 2 })
@Html.CheckBox(\"orderNumbers\", new { value = 3 })
@Html.CheckBo         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 09:02

    Because thats how the provided CheckBoxFor helper is working.

    You have to generate the html for the checkboxes yourself. Then the hidden inputs are not generated and you will get only the selected integer values.

提交回复
热议问题