我在用戶控件GridView和動態添加使用佔位符 的控制現在我發現從電網給它控制未在電網 代碼存在的控件是如下:查找動態添加控件從GridView的在SharePoint
foreach (GridViewRow row in GridView1.Rows)
{
PlaceHolder plc = (PlaceHolder)row.FindControl("lblPlaceHolder");
TextBox txtTextBox1 = plc.FindControl("txtTextBox1") as TextBox; //its give Null
}
任何人都可以有答案PLZ
增加從評論代碼:
foreach (GridViewRow dr in GridView1.Rows)
{ PlaceHolder placeHolder = dr.FindControl("lblPlaceHolder") as PlaceHolder;
TextBox txtTextBox1= new TextBox();
txtTextBox1.Width = 300;
placeHolder.Controls.Add(txtTextBox1);
}
謝謝你先生,我已經試過這個,但仍然給零值 –
好吧,plc有一個值或它是否也是? –
plc的值不爲空 –