Search code examples
c#jqueryasp.netgridviewlinkbutton

Find gridview linkbutton value jquery


my gridview got few column.Column 1 is ID which is a linkbutton field , column 2 is CustName which also is a linkbutton field, column 3 is address which is a normal cell text .Here i got a question. How can i get the column 2 value when i click the ID button by Jquery?

Here my coding

   $("a.ID").click(function (e) {
            var row = $(this).parents("tr:first");
        var Desc= row.children("td:eq(2)").text();
            var test = row.children("td:eq(1) a").text();???Here error
            alert(test);

        });

I am able to get the colum 3 value when click the particular selected row.


Solution

  • I don't know outright why that doesn't work, but try separating it:

    row.children("td:eq(1)").find('a').text();