Mudassir Hasan
Mudassir Hasan

Reputation: 28741

Find textbox value in gridview of checked row using Jquery

I have a Gridview having checkbox and textbox column. How to retrieve value of textbox belonging to checked row .

var checkCheckBox = $("#<%=GrdV.ClientID %> [id*=chkOrder]");
            $(checkCheckBox).click(function () {
                if ($(this).is(':checked')) {

                  alert($(this).parent("tr").find($("[id *= txtboxQty]")).val()); 
             }

shows

undefined.

Upvotes: 1

Views: 2908

Answers (1)

Jai
Jai

Reputation: 74738

try with this:

alert($(this).closest("tr").find($("[id*=txtboxQty]")).val());

here .closest() is been used to traverse up to the tr which is grand parent, because .parent() returns the parent dom node.

Upvotes: 2

Related Questions