0
我有一個Repeater
以及一個Button
。如果我點擊我的按鈕,需要在客戶端(Javascript)的中繼器上創建新行。我能夠在服務器端做到這一點,但想避免回發。我沒有使用Ajax Updatepanel
控件。此外,我在我的Repeater
中使用表結構。如何將行添加到客戶端的中繼器中
我有一個Repeater
以及一個Button
。如果我點擊我的按鈕,需要在客戶端(Javascript)的中繼器上創建新行。我能夠在服務器端做到這一點,但想避免回發。我沒有使用Ajax Updatepanel
控件。此外,我在我的Repeater
中使用表結構。如何將行添加到客戶端的中繼器中
由於您的Repeater
只是產生一個表,因此這裏有一些javascript可以將一行添加到表中。
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
}
這隻會添加它的客戶端,雖然如此,如果你想要它回發你將需要使用將發佈其數據的元素存儲數據。