0
votes

I have a gridview that contains a .xls columns which has checkbox in its item template. If none of the checkbox is selected for that xls column and user clicks the submit button the alert should be fired saying that "no rows has been selected". I have written a JS for the same but i need to check as to how many checkboxes are selected by user. If it is zero than the alert should appear else alert should not appear.

My Quesiton: How to get number of rows checked in gridview through JS?

Below is JS which i have written

function zeroExportSelection() {
                 alert('Please select at least one record!');
                 return false;
             }

Let me know if you have any query.Thanks!

1
check the answers here stackoverflow.com/questions/349055/… not a direct solution to your post but definitely it will help - Waqas
thanks waqas the link helped! - xorpower
stackoverflow.com/questions/7163160/… I hope that helps. Cheers. - vtortola

1 Answers

0
votes

You need to use a selector. If your results are contained in a div for example, use something like:

var checkedCount = $("#myDivId input:checked").length;