ONclick on tr

Previously i use linkbutton in gridview for when user click on that button then pop up appear…
and this succesfully work but now i want when user click on row then pop up … for link button i use this

$(function () {
    $('[ID*=lbViewChart]').on('click', function () {
        var row = $(this).closest('tr');
        var Id = row.find('td')[0].firstChild.data;
        var obj = {};
        obj.ID = Id;
        GetData(obj);
        return false;
    });

Now i want when user click on row then pop up appear for this i modify this code to this

$(function () {
     $('#tabledata tr').click(function () {
    var row = $(this);
    var Id = row.find('td')[0].firstChild.data;
    var obj = {};
    obj.ID = Id;
    GetData(obj);
    return false;
});

i try this but nothing happens

Should be able to just modify the selector to match the tr’s in that case.

$('tr').on('click', function(event) {
    var row = $(event.target).closest('tr');
    var ID = row.find('td')[0].firstChild.data;
    GetData({ ID: ID });

    return false;
});
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.