我想知道当整个内容在contentplaceholder1.i中时我如何访问fileupload控件id尝试使用FindControlRecursive(控制根,字符串Id)方法,我已经调用它像FindControlRecursive(contentplaceholder1,fileupload1)但它不是working.so plz给出一些想法如何找到fileupload1 id
答案 0 :(得分:1)
您可以使用MasterPage
控件的FindControl
方法在FileUpload
页面中查找Content
控件。
protected void Page_Load(object sender, System.EventArgs e)
{
ContentPlaceHolder content = Page.Master.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
FileUpload fu = content.FindControl("FileUpload1") as FileUpload;
//...
}