WEB开发 画面可不可以实现动态添加文本框? 怎样实现?

解决方案 »

  1.   

    完全可以实现:
    例:.ASPX<asp:Repeater id=list runat=server>
    <itemtemplate>
    <asp:textbox id =txt runat=server />
    </itemtemplate>
    </asp:repeater>
    .ASPX.CS
       
    //生成十个TEXTBOX
        string[] str = new string[10];
        list.DataSource = str;
        list.DataBind();
      

  2.   

    TextBox tb = new TextBox();
    this.Controls.Add(tb);
      

  3.   

    前台:
    <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" border="1" runat="server"><TR><TD></TD><TD></TD></TR></TABLE>
    后台:
    TextBox tb = new TextBox();
    Table1.Rows[0].Cells[0].InnerText = "养老金";
    Table1.Rows[0].Cells[1].Controls.Add(tb);