mary jean ligas

mary jean ligas

  • NA
  • 420
  • 195.8k

assigning unique ids in all clone textboxes

Jan 6 2015 9:53 PM

how to a assign unique id to all clone textboxes..i need it badly please help..

 

<script type="text/javascript">


function Clone() {

var srcTable = document.getElementById("srcTable");


var clonedTable = srcTable.cloneNode(true);


clonedTable.id = ""; // clear the id property of the cloned table


//var container = document.getElementById("container");


var container = document.getElementById("tr");



container.appendChild(clonedTable);


}


function CloneDiv() {


var srcTable = document.getElementById("SubDiv");


var clonedTable = srcTable.cloneNode(true);


clonedTable.id = "";


var container = document.getElementById("MasterDiv");



container.appendChild(clonedTable);


}


function getID(txt) {


var id = txt.id;



}


</script>

 
design Page: 

<div id="MasterDiv">

<div id="metric_results">

<input type="button" id="create" value="Click here" onclick="Javascript:addTable()">

</div>

<div id="SubDiv" runat="server">

<div>

<asp:Image runat="server" id="imgExpand" ImageUrl="~/expand-blue.png"/>

<asp:Image runat="server" id="imgCollapsed" ImageUrl="~/collapse-blue.png" />

<asp:Label ID="Label1" runat="server" Text="PLANT"></asp:Label>

</div>

<div id="divHide">

<div id="container" style="overflow: scroll; overflow-y:hidden; width:1000px">

<table cellpadding=0 cellspacing=0 >

<tr id="tr">

<td valign="top">

<table cellpadding=0 cellspacing=0 width="400px">

<tr>

<td height="21px"></td>

</tr>

<tr>

<td height="21px"></td>

</tr>

<tr>

<td>WSP (VAT-Inc; Including of FTH Recharge)</td>

</tr>

<tr>

<td>GROSS REVENUE (VAT EX)</td>

</tr>

<tr>

<td>LESS: DISCOUNTS</td>

</tr>

<tr>

<td>NET REVENUE</td>

</tr>

<tr>

<td>@NTG</td>

</tr>

<tr>

<td>DIRECT COGS:</td>

</tr>

<tr>

<td>Std Concentrate Cost</td>

</tr>

<tr>

<td>Actual</td>

</tr>

<tr>

<td>Sugar</td>

</tr>

<tr>

<td>Other Raw Materials</td>

</tr>

<tr>

<td>Packaging Raw Materials</td>

</tr>

<tr>

<td>Overhead</td>

</tr>

<tr>

<td>Purchased FG</td>

</tr>

<tr>

<td>OTHER VARIABLE COST:</td>

</tr>

<tr>

<td>Delivery/Freight</td>

</tr>

<tr>

<td>EDS/Distributor Fees</td>

</tr>

<tr>

<td>Sales Commission</td>

</tr>

<tr>

<td>TOTAL VARIABLE COSTS</td>

</tr>

<tr>

<td>MARGINAL CONTRIBUTION</td>

</tr>

<tr>

<td>%MC</td>

</tr>

<tr>

<td>LESS: BUNDLING COST PER CASE</td>

</tr>

<tr>

<td>Manpower</td>

</tr>

<tr>

<td>Material (please specify)</td>

</tr>

<tr>

<td>1.</td>

</tr>

<tr>

<td>2.</td>

</tr>

<tr>

<td>3.</td>

</tr>

<tr>

<td>4.</td>

</tr>

<tr>

<td>5.</td>

</tr>

<tr>

<td>TOTAL BUNDLING COSTS PER CASE</td>

</tr>

<tr>

<td>NET MARGINAL CONTRIBUTION</td>

</tr>

<tr>

<td>%MC</td>

</tr>

</table>

</td>

<td valign="top" id="srcTable">

<table cellpadding=0 cellspacing=0>

<tr>

<td colspan="5" align="center">P-Reg Sample</td>

</tr>

<tr>

<td colspan="2" align="center">ACTUAL</td>

<td>AOP</td>

<td colspan="2" align="center">(B/W)</td>

</tr>

<tr>

<td>FROM(Current)</td>

<td>TO(Proposed)</td>

<td></td>

<td>vs.Current</td>

<td>vs.AOP</td>

</tr>

<tr>

<td><asp:TextBox ID="sample" runat="server" Text="0.00" onblur="getID(this)"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

<tr>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>

</tr>

</table>

</td>

</tr>

</table>

</div>

</div>            

</div>

</div>

 
CODE BEHIND:
 

protected void Page_Load(object sender, EventArgs e)

{

for (int x = 0; x < 2; x++)

{

for (int i = 0; i < 1; i++)

{

ScriptManager.RegisterStartupScript(this, GetType(), "CloneTable" + i, "Clone();", true);

}

ScriptManager.RegisterStartupScript(this, GetType(), "CloneDiv" + x, "CloneDiv();", true);

}

 

Answers (2)