开发者

get fileupload id in code behind when the page inside masterpage

开发者 https://www.devze.com 2022-12-13 06:10 出处:网络
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 ha

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

精彩评论

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

关注公众号