Pass values of checkBox to controller action in asp.net mvc4

后端 未结 12 1543
长发绾君心
长发绾君心 2020-12-14 00:31

I want to test if the checkbox is checked or not from my action method, what i need is to pass checkbox value from view to controller.

This is my view:



        
12条回答
  •  暖寄归人
    2020-12-14 01:04

    For some reason Andrew method of creating the checkbox by hand didn't work for me using Mvc 5. Instead I used this

    @Html.CheckBox("checkResp")
    

    to create a checkbox that would play nice with the controller.

提交回复
热议问题