asp.net - Download file is not working with update progress -


i have problem when downloading file progress bar .

this have in aspx page .

<asp:updatepanel id="up1" runat="server">     <contenttemplate>         <asp:tabcontainer id="tabcontainer1" runat="server" cssclass="fancy fancy-green" align="left" activetabindex="0">         <asp:tabpanel id="crrecomd_customers" runat="server">             <contenttemplate>                  <asp:button id="btn_cplrecomoned_customers" runat="server" validationgroup="v3" cssclass="button" text="generate crs recommended" width="297px" onclick="getcuctomerscrs" height="43px" />              </contenttemplate>         </asp:tabpanel>         <asp:updateprogress id="updateprogress1" runat="server">             <progresstemplate>                 <div id="background"></div>                 <div id="progress">                     <img src="images/loading.gif" style="vertical-align: middle" />                     fetching records please wait...                 </div>             </progresstemplate>         </asp:updateprogress>      </contenttemplate> </asp:updatepanel> 

and in code behind have written following code download file

if(chk_download.checked) {                 response.clear();                response.buffer = true;                response.contenttype = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";                response.addheader("content-disposition", "attachment;filename=" + filename + ".xls");                response.flush();                response.binarywrite(crdatastream);                httpcontext.current.applicationinstance.completerequest();            } 

the problem here when click on btn_cplrecomoned_customers button progress bar displaying file not downloaded . if remove section of displaying progress bar file downloaded successfully.

i not getting error when click on download button, shows progress bar time (about 1 min) after same screen appear without error or information ...

could 1 tell me proper solution ?

thanks.

the issue searching making progress bar going away code allows download.

i add following items outputstream complete prior completerequest allows file download.

        httpcontext.current.response.outputstream.flush()         httpcontext.current.response.outputstream.close()          httpcontext.current.applicationinstance.completerequest() 

this permit file download in browser doesn't make progress panel disappear. hope helps.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -