I have a Repeater
and also a Button
. If I click on my button a new rows need to be created to the repeater in client side (javascript). I am able to do this with server side, but want to avoid a postback. I am not using an Ajax Updatepanel
control. Moreover I am using a table structure in my Repeater
.
views:
34answers:
1
A:
Since your Repeater
is just producing a table, here is some javascript to add a row to a table.
function AddRowToTable()
{
// Add your table name to the getElementById
var table = document.getElementById("yourTableID");
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
// Create any cells and elements you need
var cell1 = row.insertCell(0);
var element1 = document.createElement("input");
element1.type = "text";
cell1.appendChild(element1);
// repeat for more cells / elements as required
}
This will just add it client side though so if you want it to postback you will need to store the data using elements that will post their data.
Kelsey
2010-08-10 05:15:36