function OnAddClick(){ str = "<tr id='" + ctrl + "'><td><input id='btn" + ctrl.toString() + "'" + " runat='server' value= '" + ctrl.toString() + "' type='button' onclick='GetId(this)'/></td>"; for (var i = 0; i < ctrlstr.length; i++) { str = str + "<td><asp:Label id='lbl" + document.getElementById(ctrlstr[i]).id + ctrl + "' runat='server' >" + document.getElementById(ctrlstr[i]).value + "</asp:Label></td>"; } str = str + "</tr>"; $('#tblMain').append(str).addClass('NewRecord'); } function GetId(controlid) { //alert(controlid.id); var rowid = controlid.id.toString().substring(4, 3); var table = $("#tblMain #" + rowid + "").find('Label')[0].id; for (var i = 0; i < ctrlstr.length; i++) { $("#" + document.getElementById(ctrlstr[i]).id + "").val($("#tblMain #" + rowid + "").find('Label')[i].innerHTML.toString()); } $("#hdnRowId").val(rowid); }
OnAddClick()
GetId()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)