未将对象引用设置到对象的实例,麻烦大家帮小弟我看看是什么有关问题
未将对象引用设置到对象的实例,麻烦大家帮我看看是什么问题
for (int i = 1; i <= Convert.ToInt32(secTextBox1.Text); i++)
{
TextBox tx1 = new TextBox();
tx1.ID = "tx1" + i.ToString();
thrid.Controls.Add(tx1);
}
for (int i = 1; i <= a; i++)
{
TextBox a1 = new TextBox();
a1 = (TextBox)thrid.FindControl("tx1" + i.ToString());
if (a1.Text!= "")
{
Response.Write("sas");
}
两个循环的次数是一样的,分别在不同的button_click中,
在执行第二个循环时 停留在 if (a1.Text!= "")
未将对象引用设置到对象的实例
------解决方案--------------------
例如
Request.Form["tx21"]
就可以得到 tx21的输入的内容啊
for (int i = 1; i <= Convert.ToInt32(secTextBox1.Text); i++)
{
TextBox tx1 = new TextBox();
tx1.ID = "tx1" + i.ToString();
thrid.Controls.Add(tx1);
}
for (int i = 1; i <= a; i++)
{
TextBox a1 = new TextBox();
a1 = (TextBox)thrid.FindControl("tx1" + i.ToString());
if (a1.Text!= "")
{
Response.Write("sas");
}
两个循环的次数是一样的,分别在不同的button_click中,
在执行第二个循环时 停留在 if (a1.Text!= "")
未将对象引用设置到对象的实例
------解决方案--------------------
例如
Request.Form["tx21"]
就可以得到 tx21的输入的内容啊