Skip to content Skip to sidebar Skip to footer

How To Add Rows To A Repeater In Client Side

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 w

Solution 1:

Since your Repeater is just producing a table, here is some javascript to add a row to a table.

functionAddRowToTable()
{  
    // Add your table name to the getElementByIdvar table = document.getElementById("yourTableID");  
    var rowCount = table.rows.length;  
    var row = table.insertRow(rowCount);
    // Create any cells and elements you needvar 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.

Post a Comment for "How To Add Rows To A Repeater In Client Side"