Download feature not working within update panel in asp.net

后端 未结 7 1700
孤城傲影
孤城傲影 2020-11-29 06:13

I have a Web User Control containing a FormView. The formview shows details of job seeker. I have provided a button for \"Download Resume\" link, so that admin/

7条回答
  •  庸人自扰
    2020-11-29 06:53

    You can still trigger download doc from inside an Update Panel.

    I have an update panel and inside I have 3 nested repeaters. In the most inner repeater I build a series of download links using LinkButtons, each one containing a command to fetch the document via webservice and dispatching it.

    Each repeater has an OnItemDataBound method. In the last repeater I have the following

            protected void LinkDocRepeaterOnItemDataBound(object sender, RepeaterItemEventArgs e) {
                if(!(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)) {
                return;
                    }
                LinkButton linkButton = (LinkButton)e.Item.FindControlRecursive("LinkId");
                var scriptManager = ScriptManager.GetCurrent(this.Page);
                if (scriptManager != null) {
                   scriptManager.RegisterPostBackControl(linkButton);
                }
            }
    

    Each Linkbutton now downloads a document.

提交回复
热议问题