Please let me know how to check if any checkbox is checked in a specific column (for example first column) of the GridView control using jQuery? there are checkboxes in other columns too, but I need to check if any checkbox is checked in a specific column. thanks in advance.
2 Answers
thanks for the reply. solved it myself with help from the following link
if ($("#<%=GridView1.ClientID %> >tbody >tr >td:first-child > input[type=checkbox]:checked").length > 0) {}
1 Comment
user113716
Yeah, that's the same as my first solution.
You could do this:
var checked = $('selectorForColumn :checkbox:checked').length > 0;
or this:
var checked = $('selectorForColumn :checkbox').is(':checked');
...which will return true if at least one checkbox in the column is checked.
Not sure what the proper selector is without seeing your markup, but if it is the first column, you would do something like this:
$('table > tbody > tr > td:first-child :checkbox')