asp.net mvc - Checkbox name can't pass to controller from view -


i have checkbox in view page

using (html.beginrouteform("shoppingcart", formmethod.post, new { enctype = "multipart/form-data" })) { ... <input type="checkbox" name="removefromcart_@item.id" class="remove-@item.id" value="@(item.id)" style="display:none;" /> ... } <script>    $("tr.cart-item-row > td > input[type=checkbox]").click(function () {         if ($(this).is(":checked")) {             $('input[type=checkbox].remove-' + this.value).prop('checked', true);         } else {             $('input[type=checkbox].remove-' + this.value).prop('checked', false);         }     }); </script> 

so want pass name(removefromcart_@item.id) of checkbox controller.

but can't handle because when submit form, markup of checkbox delete(mean when submit form dont name of checkbox in controller) can't name of checkbox in controller.

so please suggest how sort out issue ?

when form submitted, if checkbox not checked won't in post data. need search in post data make sure if checkbox existing or not in controller instead checking value. because again, if submitted without checked won't in post data.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -