开发者

get fileupload id in code behind when the page inside masterpage

i want to know how can i access fileupload control id when the whole content is inside contentpla开发者_JS百科ceholder1.i have tried using FindControlRecursive(Control Root, string Id) method and i have called it like FindControlRecursive(contentplaceholder1, fileupload1) but its not working.so plz give some idea how can i find the fileupload1 id


You can use the MasterPage control's FindControl method to find the FileUpload control within the Content page.

protected void Page_Load(object sender, System.EventArgs e)
{
    ContentPlaceHolder content = Page.Master.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;    
    FileUpload fu = content.FindControl("FileUpload1") as FileUpload;
    //...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜