Printing report get stuck at the first time
<p>I used JavaScript to print report in my ASP.net MVC 2.0. This is my script :</p>

<pre><code> function printPage(sURL) {
         var oHiddFrame = document.createElement("iframe");
         oHiddFrame.src = sURL;
         oHiddFrame.style.visibility = "hidden";
         oHiddFrame.style.position = "fixed";
         oHiddFrame.style.right = "0";
         oHiddFrame.style.bottom = "0";
         document.body.appendChild(oHiddFrame);
         oHiddFrame.contentWindow.onload = oHiddFrame.contentWindow.print;
         oHiddFrame.contentWindow.onafterprint = function () {
                                                     document.body.removeChild(oHiddFrame); 
                                                 };
 }   
</code></pre>

<p>This is the block of code that I called javascript : </p>

<pre><code>&lt;span onclick="printPage('/Print/PrintReport');" style="cursor:pointer;text-decoration:none;color:#0000ff;"&gt; 
   &lt;img src="/Con/art/Print.png" width="35px;" alt="print" style="position:relative;top:6px;"/&gt; 
   &amp;nbsp; Print Statement
&lt;/span&gt;
</code></pre>

<p>At the first time that I click on the <code>Print</code>icon, it is loading the print dialog but it stucks and show nothing beside this dialog. When I close the dialog and start to do it at the n times, it works fine.</p>

<p>Could any one tell me how should I do that?</p>

<p>Thanks in advanced.</p>
