简体   繁体   中英

How to get all selected checkbox from multiple pagination page in asp.net mvc?

Could someone please help me to understand how can i get all the checkbox were checked throughout all the pagination page?

using below seem only show the current page checkbox, not all pages.

Not sure if anything miss out, thanks for enlightenment!

$('input[name=myCheckbox]:checked');

Thanks in advance for your help!

This might be what you are looking for

           <input type="checkbox" onchange="selectCheckbox(this)" />

 var selectedUnits = [];
                function selectCheckbox(data) {
                    if (selectedUnits.length < 1) {
                        selectedUnits.push(data.value);
                    }
                    else {
                        if (data.checked == true) {
                            if ($.inArray(data.value, selectedUnits) < 0) {
                                selectedUnits.push(data.value);
                            }
                            else {
                                selectedUnits.pop(data.value);
                            }
                        }
                        else {
                            selectedUnits.pop(data.value);
                        }

                    }
                }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM