Bind javascript with GridView button dynamically
<p>I've been trying to do this for the past hour and still got nothing. I'll try to explain it so please stay with me:</p>

<p>I'm trying to create a sort of summary shopping cart by creating an HTML table using javascript and adding rows every time an item is selected from the gridview.</p>

<p>I have a gridview with a TemplateField containing a button. The gridview looks like this:</p>

<pre><code>Property | Quantity | Order | Action
Pencil | 10 | (textbox) | (button)
Pen | 5 | (textbox) | (button)
</code></pre>

<p>Supposedly, the button has an onclientclick event which will insert a new row to the HTML table (summary shopping cart).</p>

<pre><code>&lt;SCRIPT language="javascript"&gt;
        function addRow(tableID,property,order) {

        var table = document.getElementById(tableID);

        var rowCount = table.rows.length;
        var row = table.insertRow(rowCount);

        var cell1 = row.insertCell(0);
        cell1.innerHTML = property;

        var cell2 = row.insertCell(1);
        cell2.innerHTML = order;

    }
</code></pre>

<p>I don't know how to bind this javascript to the (button) in my GridView though. I can't bind it on the DataBound event because I'll have to pass the value of (textbox).</p>
