Internet Explorer modal dialogs require IFrames to access the WebBrowser COM interface. SQL Server 2008 R2 changed from using IFrames to AJAX update panels. If you launch SQL Server 2008 R2 report using the IE modal dialog, and try to print the report using the print option on the report, then the following error message appears:

Print Error
An error occurred trying to get the current window.

Steps to reproduce the issue:

  • Create a simple HTML page with a button.
  • In the Onclick event of the button, use the following script with the proper report server URL:
    <button onClick="window.showModalDialog ('http://serverName/ReportServerR2?/SimpleSelect&rc:Parameters=False&rs:ClearSession=True',null, 'dialogHeight:730px;dialogWidth:1010px');" >Click Me</button>

    Open the page in IE and Click the button.

  • Once the report come up fine, click on the Print icon for the report. It will immediately throw the error.


To use a modal dialog with SQL Server 2008 R2 report, have the modal dialog contain an IFrame containing the report.