protected void Button1_Click(object sender, EventArgs e) { TotalControls = TotalControls + 1; TableCell cell = new TableCell(); TextBox tb = new TextBox(); tb.ID = "TB1" + TotalControls.ToString(); cell.Controls.Add(tb); row.Cells.Add(cell); Table1.Rows.Add(row); }
protected void Button2_Click(object sender, EventArgs e) { for (int i = 1; i <= TotalControls; i++) { str[i - 1] = ((TextBox)this.FindControl("TB1" + i.ToString())).Text; } Label1.Text = str[0]; Label2.Text = str[1]; Label3.Text = str[2]; Label4.Text = TotalControls.ToString(); for (int i = 1; i <= TotalControls1; i++) { str1[i - 1] = ((TextBox)this.FindControl("TB" + i.ToString())).Text; } Label5.Text = str1[0]; Label6.Text = str1[1]; Label7.Text = str1[2]; Label8.Text = TotalControls1.ToString(); }