........................................略
TableCell tc4 = new TableCell();
TextBox findbox = new TextBox();
findbox.ID = "FindBox";
findbox.EnableViewState = true;
findbox.SkinID = "FindBox";
Button bn = new Button();
bn.Text = "查找";
bn.Click += new EventHandler(this.FindButtonClick);
tc4.Controls.Add(findbox);
tc4.Controls.Add(new LiteralControl(" "));
tc4.Controls.Add(bn);
tc4.Controls.Add(new LiteralControl(" "));
........................................略 protected void FindButtonClick(object sender, EventArgs e)
{
GridViewRow pagerRow = this.GridView1.BottomPagerRow;
TextBox txtNum = (TextBox)pagerRow.Cells[0].FindControl("FindBox");
this.Label1.Text =txtNum.Text.ToString();
} // 可以取到控件ID,但取不到输入的值
TableCell tc4 = new TableCell();
TextBox findbox = new TextBox();
findbox.ID = "FindBox";
findbox.EnableViewState = true;
findbox.SkinID = "FindBox";
Button bn = new Button();
bn.Text = "查找";
bn.Click += new EventHandler(this.FindButtonClick);
tc4.Controls.Add(findbox);
tc4.Controls.Add(new LiteralControl(" "));
tc4.Controls.Add(bn);
tc4.Controls.Add(new LiteralControl(" "));
........................................略 protected void FindButtonClick(object sender, EventArgs e)
{
GridViewRow pagerRow = this.GridView1.BottomPagerRow;
TextBox txtNum = (TextBox)pagerRow.Cells[0].FindControl("FindBox");
this.Label1.Text =txtNum.Text.ToString();
} // 可以取到控件ID,但取不到输入的值
lz
==========
findbox 的viewstate可能在FindButtonClick事件的autopostback时丢失.
DropDownList list = (DropDownList)rows.FindControl("DropDownList1");我用过这个你试试看。
都不是因为这个
BottomPagerRow 是只读的,如何解决?