Getting the cell data from the HTML Table using Java script upon pressing Edit button
<p>I created a HTML table and populated with the values from the database. Now i wanna create edit functionality to this table.I added Edit button to each row of the table. I need to know the corresponding rowID upon pressing the relevant edit button.I am using java script to get the ID of the row but unfortunately i was getting only details of First row. I guess i need to put some for loop. I need this ID to pass another page so that it populates the values of that corresponding entries and user can edit the entries and save them.</p>

<p>(I am developing in dotnet but i dont wanna use any gridview control to do this).</p>

<p>Please send me any sample code or solution if you have.</p>

<pre><code>&lt;tr id= "listings"&gt;
    &lt;td style="width:16%; vertical-align:top; border-bottom: solid 1px black;" id = "ids"&gt;@@P.ID@@&lt;/td&gt;
    &lt;td style="width:16%; vertical-align:top; border-bottom: solid 1px black; text-align:right;"&gt;@@P.NAME@@&lt;/td&gt;
    &lt;td style="width:2%; vertical-align:top; border-bottom: solid 1px black; text-align:right;"&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt;
    &lt;td style="width:16%; vertical-align:top; border-bottom: solid 1px black;"&gt;@@P.DESCRIPTION@@&lt;/td&gt;
    &lt;td style="width:16%; vertical-align:top; border-bottom: solid 1px black;"&gt;@@P.DATEAPPROVED@@&lt;/td&gt;
    &lt;td style="width:16%; vertical-align:top; border-bottom: solid 1px black; text-align:right;"&gt;@@P.TOTALCOST@@&lt;/td&gt;
    &lt;td style="width:2%; vertical-align:top; border-bottom: solid 1px black; text-align:right;"&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td style="width:16%; vertical-align:top; border-bottom: solid 1px black; text-align:right;"&gt;
    &lt;button name = "editButton" type = "button" value = "Edit" onclick="test()"&gt;
    Edit
    &lt;/button&gt;

    &lt;/td&gt;

    &lt;/tr&gt;

&lt;script type="text/javascript"&gt;
    function test() {
        var elTableRow = document.getElementById("listings");
        var elTableCells = elTableRow.getElementsByTagName("td");
        alert(elTableCells[0].innerText);
 }    

&lt;/script&gt;
</code></pre>
