I have created clone rows of a gridview in my asp.net project using javascript like this
function CreateGrid() {
var Grid = document.getElementById('<%=GridView1.ClientID%>')
for (var i = 1; i < 6; i++) {
var newrow = Grid.rows[Grid.rows.length - 1].cloneNode(true);
newrow.cells[0].innerText;
newrow.cells[1].children[0].value = '';
newrow.cells[2].children[0].value = '';
Grid.appendChild(newrow);
}
}
I want when I click on any cells it returns me the exact row number, So I have written this code
function GetRowIndex(node) {
var row = node.parentNode.parentNode;
alert(row.rowIndex);
}
But when I am clicking on any row it always return -1
How can I achieve this ?