根据数据的条数动态创建textbox,然后在后面调用该怎么写
谢谢

解决方案 »

  1.   

    TextBox txt = new TextBox();
    txt.ID = "txt1";
    Page.Controls[1].Controls.Add(txt);=======
    后面如果需要取用户在txt1中输入的值,则:
    string aaa = Reqeust.Form["txt1"];
      

  2.   

    txt.ID = "txt1";
    如果形成5个,那这5个都一个id吗
      

  3.   

    new 一个textbox数组
    有多少数据,数组的大小就是相应的需要创建的数量
    使用的时候,通过数组的index来使用画到窗体上,就需要设置每个textbox的属性就可以了
      

  4.   

    刚做的一个简单的例子
    TextBox textBox2 = new TextBox();
    // Set the Multiline property to true.
    textBox2.Multiline = false;
    // Add vertical scroll bars to the TextBox control.
    textBox2.ScrollBars = ScrollBars.Vertical;
    // Allow the RETURN key to be entered in the TextBox control.
    textBox2.AcceptsReturn = true;
    // Allow the TAB key to be entered in the TextBox control.
    textBox2.AcceptsTab = true;
    // Set WordWrap to True to allow text to wrap to the next line.
    textBox2.WordWrap = true;
    // set TextBox POSTION
    textBox2.Location.X = 10;
    textBox2.Location.Y = 10;
    // Set the default text of the con
    this.Controls.Add(textBox2);
      

  5.   

    也可页面js方式动态创建<input type=text>
      

  6.   

    建了个数组
    运行时出错:类型“TextBox”的控件“ctl02”必须放在具有 runat=server 的窗体标记内
    这东西从哪改?
      

  7.   

    主要想把他显示在表格里,不知道怎么设定啊已经
    Response.Write("<td>")
    tbx(c) = New TextBox()
    tbx(c).Text = z
    form1.Controls.Add(tbx(c))
    Response.Write("</td>")
    这样不出上面的错误,但都在表格外面横着显示