我添加控件動態爲佔位符,其內的ContentPlaceHolder如何在ContentPlaceholder和佔位符中查找控件?
var t = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
var t1 = (PlaceHolder)mpContentPlaceHolder.FindControl("PlaceHolderName");
var t2 = (DropDownList)t1.FindControl("ControlID");
它看起來像我失去了一些東西,因爲T2總是空
'mpContentPlaceHolder'實際上應該是't'嗎?另外,確保你沒有在'(!IsPostBack)'塊中添加控件。 – Brad 2010-09-23 18:58:19