2

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 2

3

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) {}

http://www.codedigest.com/CodeDigest/63-Check-All-Checkboxes-in-a-Particular-Column-in-GridView-using-JQuery-.aspx

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, that's the same as my first solution.
1

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')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.