获得的价值我已经创建了页面加载编程的文本框为使用下面的代码:无法从动态创建文本框
HtmlTableRow row = new HtmlTableRow();
HtmlTableCell cell1 = new HtmlTableCell();
HtmlTableCell cell2 = new HtmlTableCell();
cell1.Controls.Add(new Label() { ID = LableID1, Text = Name });
cell2.Controls.Add(new TextBox() { ID = TextBoxID1 });
row.Cells.Add(cell1);
row.Cells.Add(cell2);
dynamictable.Rows.Add(row);
,并在按钮单击事件我想获得从价值文本框,并指定该值被静态创建如下anohter文本框:
string id = TextBoxID1
TextBox tb = (TextBox)dynamictable.FindControl(id);
string valuetext = tb.Text;
TextBox1.Text = valuetext;
我得到的对象引用错误,我的意思是,我不能够找到控制和创建文本框。
我试图创建文本框,如下方法也:
TextBox tb = (TextBox)form1.FindControl(id);
TextBox tb = (TextBox)this.form1.FindControl(id);
TextBox tb = (TextBox)page.FindControl(id);
任何帮助将是对我非常有帮助的。
有这样的事情,你的时机问题,确保创建了控件并再次附上事件回发。也是它的cell1,这是文本框的父母不是你试过的任何东西 – 2012-08-10 06:10:49