2017-11-09 23 views
0

Excel 파일 다운로드 중에 이미지 로더를 사용하려고했습니다. 이것은 현재 코드입니다. aspx 페이지에서 파일 다운로드가 완료된 후에도 PostbackTrigger가있는 UpdatePanel이 동결되었습니다.

function ShowProgress() { 
    document.getElementById('<% Response.Write(prgLoadingStatus.ClientID); %>').style.display = "inline"; 
} 

자바 스크립트

에서

<asp:UpdatePanel ID="upAlignBuyer" runat="server" UpdateMode="Conditional" EnableViewState="true" > 
<ContentTemplate> 
    <asp:Button ID="Button2" Text="Download BWS" CssClass="app_button" 
     Font-Bold="true" value="DownloadExcel" OnClick="Download_Click" OnClientClick="ShowProgress();" 
     runat="server" Height="23px" Width="120px"></asp:Button> 
    <asp:UpdateProgress ID="prgLoadingStatus" runat="server" DynamicLayout="true" AssociatedUpdatePanelID="upAlignBuyer" > 
     <ProgressTemplate> 
      <div id="overlay"> 
       <div id="modalprogress"> 
        <div id="theprogress"> 
         <asp:Image ID="imgWaitIcon" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/App_Themes/Images/progress.gif" /> 
          Please wait... 
        </div> 
       </div> 
      </div> 
     </ProgressTemplate> 
    </asp:UpdateProgress> 
</ContentTemplate> 
<Triggers> 
    <asp:PostBackTrigger ControlID="Button2" /> 
</Triggers> 
</asp:UpdatePanel> 

그래서이 문제는 제대로 이미지가로드를로드하고 파일을 제대로 다운로드됩니다되지만 파일 가져 후에도 로딩 이미지를 표시 유지 다운로드. 도움이 될 것입니다.

답변

0

이것은 좋은 해결책이 아니지만이 방향으로 가고 있습니다. 파일이 다운로드되면 페이지 상태가 "완료"로 설정되지 않는 것처럼 보입니다.이 상태는 항상 "대화식"으로 끝납니다. 따라서이 문제는 해결되었습니다.

document.onreadystatechange = function() { 
     if (document.readyState === "interactive") { 
       HidePrograss(); 
     } 
} 

function ShowProgress() { 
    document.getElementById('<% Response.Write(prgLoadingStatus.ClientID); 
      %>').style.display = "inline"; 
} 

function HidePrograss() { 
     document.getElementById('<% Response.Write(prgLoadingStatus.ClientID); 
      %>').style.display = "none"; 
} 

이렇게하면 updateprogress가 표시되지 않으며 파일을 다운로드하는 동안 아무 것도 표시되지 않게됩니다.

누구든지 더 좋은 해결책이 있으면 알려 주시기 바랍니다.