动态创建表格,行,列, 选择框,非常经典!!!

 if (this.TextBox1.Text.Trim() != "")
        {
            int len = int.Parse(this.TextBox1.Text.Trim());
            for (int i = 0; i < len; i++)
            {
                TableCell tc = new TableCell();
                TableCell tc2 = new TableCell();
                TextBox txt = new TextBox();
                txt.ID = "txt" + i.ToString();
                LiteralControl lc = new LiteralControl("<input id='Button2' type='button' value='button' onclick=javascript:fun('"+txt.ID+"') />");
                tc.Controls.Add(txt);
                tc2.Controls.Add(lc);
                TableRow tr = new TableRow();
                tr.Cells.Add(tc);
                tr.Cells.Add(tc2);
                this.Table1.Rows.Add(tr);
            }
        }
原文地址:https://www.cnblogs.com/MySpace/p/1599769.html