Get selected row count in gridview javascript
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 m开发者_JAVA百科e know if you have any query.Thanks!
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;
精彩评论