I am using this Javascript below to dynamically add controls to an asp.net web form, which is working perfectly well. I need to add onClick event to the Button to pull data from SQL server database to auto populate the textboxes. Can somebody help me or guide me how to do that.
Javascript code
--------------------
<script type="text/javascript">
function addRow(tableID)
{
var newRow = document.getElementById("empRec1").insertRow(0);
var oCell = newRow.insertCell(0);
oCell.innerHTML = "<input type='Button' name='t1' size='9' Value='Select Employee'>";
oCell = newRow.insertCell(1);
oCell.innerHTML = "<input type='text' name='t2' size='2'>";
oCell = newRow.insertCell(1);
oCell.innerHTML = "<input type='text' name='t2' size='2'>";
oCell = newRow.insertCell(1);
oCell.innerHTML = "<input type='text' name='t2' size='2'>";
oCell = newRow.insertCell(1);
oCell.innerHTML = "<input type='text' name='t2' size='2'>";
}
</script>