2009-06-10 4 views
2

코드를 사용하여 팝업에서 pdf 파일을 내보내는 중입니다.ASP.NET의 Crystal 보고서에 문제가 있습니다 - ExportToHttpResponse

function popupReport() 
    { 
     var url = 'Report.aspx'; 
     window.open(url, 'winPopupReport', 'width=300,height=300,resizable=no,scrollbars=no,toolbar=no,directories=no,status=no,menubar=no,copyhistory=no'); 
     return false; 
    } 

및 Report.aspx.cs

ReportDocument repDoc = (ReportDocument) System.Web.HttpContext.Current.Session["StudyReportCrystalDocument"]; 
     // Stop buffering the response 
     Response.Buffer = false; 
     // Clear the response content and headers 
     Response.ClearContent(); 
     Response.ClearHeaders(); 
     try 
     { 
      repDoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "StudyReport"); 
     } 
     catch(Exception ex) 
     { 
     } 

코드는 IE7에서 잘 작동에 버튼 클릭에

. 그러나 IE6에서는 팝업 창이 닫히지 않습니다. 왜 이런 일이 일어난거야?

답변

0

일부 브라우저는 일부 조건에서 웹 페이지의 자동 닫기를 거부합니다.

페이지를 닫으려면이 작업장을 사용해보십시오.

닫기를 원하는 페이지에 다른 페이지가 열리는 스크립트를 작성하십시오. 이 샘플에서는 버튼 클릭 후 코드를 통해 스크립트를 주입하지만 필요한 경우 HTML로 직접 작성할 수 있습니다.

ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.open('Success.htm', '_self', null);", true); 

이 방법

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
<head> 
    <title></title> 
    <script language="javascript" type="text/javascript"> 
    var redirectTimerId = 0; 
    function closeWindow() { 
     window.opener = top; 
     redirectTimerId = window.setTimeout('redirect()', 2000); 
     window.close(); 
    } 

    function stopRedirect() { 
    window.clearTimeout(redirectTimerId); 
} 

    function redirect() { 
    window.location = 'default.aspx'; 
} 
</script> 
</head> 
<body onload="closeWindow()" onunload="stopRedirect()" style=""> 
    <center><h1>Please Wait...</h1></center> 
</body></html> 
을 Success.htm 페이지 만들기
관련 문제