Asp.net ajax客户端框架无法加载。 [英] Asp.net ajax client-side framework failed to load.

查看:97
本文介绍了Asp.net ajax客户端框架无法加载。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里在下面的代码中点击打印按钮即可调用Javascript函数openPDF()。但是这会导致一些运行时错误: ASP.NET Ajax客户端框架无法加载在newWin.document.write(divToPrint.innerHTML);



它还在动态页面中生成sys not found错误。



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.

<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:

<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>







<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>

推荐答案

(# btnPrint,#btnBack,#btnClose)。hide();
var divToPrint = document .getElementById(' rptdiv');
newWin = window .open(' ' ' _ blank'' fullscreen = no');
newWin。 document .write(divToPrint.innerHTML); // 这里我得到了运行时错误
newWin。文档 .close();
newWin.focus();
newWin.print();
newWin.close();
//
("#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>
("#btnPrint", "#btnBack", "#btnClose").show(); return false; } </script>







<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>


添加UpdatePanel

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



将控件放在此标记内


Place your controls inside this tag


这篇关于Asp.net ajax客户端框架无法加载。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆