Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Here in the below code onclick of print button im calling Javascript Function openPDF(). but this is causing some runtime error: "ASP.NET Ajax client-side framework failed to load" at newWin.document.write(divToPrint.innerHTML);

it's also generating sys not found error in dynamic page.

JavaScript
<SCRIPT type=text/javascript>
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
//
</SCRIPT>



Thanks

What I have tried:

JavaScript
<script type="text/javascript" language="javascript">
        function openPDF() {

            //$("#btnPrint", "#btnBack", "#btnClose").hide();
            var divToPrint = document.getElementById('rptdiv');
            newWin = window.open('', '_blank', 'fullscreen=no');
            newWin.document.write(divToPrint.innerHTML); //Here im getting the run time error
            newWin.document.close();
            newWin.focus();
            newWin.print();
            newWin.close();                       
            //$("#btnPrint", "#btnBack", "#btnClose").show();

            return false;
        }
    </script>


ASP.NET
<div id="rptdiv"> 
<form id="form" runat="server" style="width: 100%; height: 100%;">        
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>  
            
<asp:Button ID="btnBack" class="classname" runat="server" Text="Back" OnClick="btnBack_Click" />                   
<asp:Button ID="btnPrint" runat="server" Text="Print" class="classname" onclick="openPDF();"  />                       
<asp:Button ID="btnClose" PostBackUrl="ReportsNewMain.aspx" class="classname" runat="server" Text="Close" /> 
                                  
<rsweb:ReportViewer ID="ReportViewer1"  runat="server" InteractivityPostBackMode="alwayssynchronous"
ProcessingMode="Remote" PromptAreaCollapsed="True" Width="100%" Height="515px" DocumentMapWidth="100%" Font-Names="Verdana" Font-Size="8pt">            
<ServerReport ReportServerUrl="" />
</rsweb:ReportViewer> 

</form>                
</div>
Posted
Updated 16-Aug-16 21:50pm
v10

1 solution

add "UpdatePanel"
then add this tag inside updatePanel
XML
<contenttemplate> place your controls here </contenttemplate>

Place your controls inside this tag
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900