Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9120017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:32:06+00:00 2026-06-17T05:32:06+00:00

I have a gridview with checkbox and I’m trying to get whether the checkbox

  • 0

I have a gridview with checkbox and I’m trying to get whether the checkbox of the clicked row is checked or not.

<td>
<input type="button" id="upbutt" value="edit" />
</td><td>60</td><td>h767</td><td>itsatesthere</td><td>cat4</td><td><span class="aspNetDisabled" title="control"><input id="GridView1_ctl00_11" type="checkbox" name="GridView1$ctl13$ctl00" checked="checked" disabled="disabled" /></span></td>

 <td>
<input type="button" id="upbutt" value="edit" />
</td><td>55</td><td>F309</td><td>ahmeds</td><td>cat1</td><td><span class="aspNetDisabled" title="control"><input id="GridView1_ctl00_8" type="checkbox" name="GridView1$ctl10$ctl00" disabled="disabled" /></span></td>/tr>


    $(function () {

        var tr = $('#GridView1').find('tr');
        tr.bind('click', function (event) {
            var tds = $(this).find('td:not(:first-child)');


            $.each(tds, function (index, item) {
                if ('#txtbadd' + (index + 1) != '#txtbadd5') {
                    $('#txtbadd' + (index + 1)).val(item.innerHTML);
                    alert($("td:has(:checkbox:checked)").text());
                }
            });

            $("#modialog").dialog("open");
            return false;
        });
    });

alert($(“td:has(:checkbox:checked)”).text());

this code works but it bring all rows with selected checkbox. I just want to know whether the clicked row checkbox is checked or not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:32:07+00:00Added an answer on June 17, 2026 at 5:32 am

    You need to pass context of current row with your selector

    Change

    alert($("td:has(:checkbox:checked)").text());
    

    To

    alert($("td:has(:checkbox:checked)", this).text());
    

    I have made little change to make two rows for demo which could help you understanding how it works and simplified javascript.

    Live Demo

    $('#GridView1 tr').bind('click', function (event) {
        alert($("td:has(:checkbox:checked)", this).length > 0 ? "Checked" : "Not checked");
    });
    

    As of jQuery 1.7, the .on() method is the preferred method over bind for attaching event handlers to a document. You can read more over here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview with a checkbox in it and I'm trying to do
I have GridView with CheckBox in it's header and another one in each row:
I have a GridView with each row containing a checkbox, and the header of
I have a GridView, which features a a checkbox on each row (in a
I have Gridview in which two textboxes and one checkbox in one row. and
I have a gridview with Template field. I add a checkbox in templatefield .
I have a gridview and I have a button on it.I want, if the
I have a GridView and SqlDataSource , I have a column type: DateTime .
I have a gridview and and I am creating it dynamically, I get parent
I have a gridview in which the first column in a checkbox. The grid

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.