如何在单元格的html表中动态添加行,使用c#添加文本框asp.net

时间:2018-12-20 12:26:53

标签: c# asp.net textbox using

我想在按钮单击时在现有表名“ table1”运行时添加行,并在td单元格中使用asp.net c#而不是jquery添加动态文本框。

Random random = new Random();
        int m = 2;
        Label lbl1 = new Label();
        lbl1.ID = "SN" + random.Next();
        lbl1.Text = Convert.ToString(++m) + ".";
        tb.Controls.Add(lbl1);
        tRow.Controls.Add(tb);
        for (int i = 1; i < 6; i++)
        {
            HtmlTableCell tb1 = new HtmlTableCell();
            Random random1 = new Random();

            TextBox txt = new TextBox();
            txt.ID = "budget" + random1.Next();
            tb1.Controls.Add(txt);
            tRow.Controls.Add(tb1);
        }
        Table1.Rows.Add(tRow);

0 个答案:

没有答案