Click here to Skip to main content
15,886,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
function GetSelectedRow(e) {
        var clickedRow = $(e).closest("tr");
        var id = $(clickedRow).find('td').eq(0).text();
        $('#<%=moduleval.ClientID %>').val(id);
        var gvcheck = document.getElementById('<%=dgv_Modules.ClientID %>');
        var chklist = gvcheck.getElementsByTagName('input');
        for (var i = 0; i < chklist.length; i++) {
            if ($(chklist[i]).prop("checked")) {

                var checkedrow = $(chklist[i]).closest("tr");
                var moduleid = $(checkedrow).find('td').eq(0).text();
                $(this).after("<tr><td  colspan = '999'>" + $(this).next().html() + "</td></tr>"); // This code line is not working.I am trying to display next element but it is displaying only empty row and it is copying second row after current row
            }
        }
        return false;
    }
Posted
Comments
Thanks7872 20-Aug-14 6:41am    
How many questions do you have with same code snippet? You have asked different questions with same snippet almost 4 times in 2 hrs.
m-shraddha 20-Aug-14 12:34pm    
Same code snippet can have different problems.
Nathan Minier 20-Aug-14 8:19am    
Using getElementByID/Tag when jQuery is loaded makes me giggle.

It depends on where that element lies on the DOM. It could be .closest(), it could be .find(), it could be .children()[0], it could be .parents()[0], it could be .siblings()[0].

Go read the jQuery docs at http://api.jquery.com/
m-shraddha 20-Aug-14 12:33pm    
thank u

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900