How to save data to a (csv/txt) file from dynamically added rows to a HTML table using C#?
<p>I have a table called "newDataTable" where I am adding new rows dynamically with the help of following JavaScript:</p>

<pre class="lang-js prettyprint-override"><code>    function addRow() 
    {
        //add a row to the rows collection and get a reference to the newly added row
        var table = document.getElementById('newDataTable');
        var lastRow = table.rows.length;
        var newRow = table.insertRow(lastRow);

        //add 6 cells (&lt;td&gt;) to the new row and set the innerHTML to contain text boxes

        var newCell = newRow.insertCell(0);
        newCell.innerHTML = "&lt;label&gt; City: &lt;/label&gt;";

        newCell = newRow.insertCell(1);
        newCell.innerHTML = "&lt;input type='text' name='tb_city'/&gt;";

        newCell = newRow.insertCell(2);
        newCell.innerHTML = "&lt;label&gt; State: &lt;/label&gt;";

        newCell = newRow.insertCell(3);
        newCell.innerHTML = "&lt;input type='text' name='tb_state'/&gt;";

        newCell = newRow.insertCell(4);
        newCell.innerHTML = "&lt;input title='Add Row' name='addButton' type='button' value='Add' onclick='addRow()' /&gt;";

        newCell = newRow.insertCell(5);
        newCell.innerHTML = "&lt;input title='Remove Row' name='deleteButton' type='button' value='Delete' onclick='removeRow(this)' /&gt;";
    }
</code></pre>

<p>So after everything this is how my page looks like:
<img src="http://i.stack.imgur.com/P2L21.jpg" alt="Screen Snippet of Form"></p>

<p>Now, how can I collect the data from the textboxes and save them in a csv/txt file when the user clicks the "Submit" button (using C#)?<br>
One obvious problem I am already seeing is that the way I am adding the rows to the HTML table will not allow me to have <code>ID</code> for each textbox. Is there any way working around this? </p>

<p>I will really appreciate any help that will allow me to save the data w/o changing the <code>addRow()</code>  Thank you!!</p>
