下面是我用来调用ReportViewer控件的打印对话框的java脚本:
<script language="javascript">
function PrintReport() {
var viewerReference = $find("ReportViewer1");
var stillonLoadState = clientViewer.get_isLoading();
if (!stillonLoadState ) {
var reportArea = viewerReference .get_reportAreaContentType();
if (reportArea == Microsoft.Reporting.WebFormsClient.ReportAreaContent.ReportPage) {
$find("ReportViewer1").invokePrintDialog();
}
}
}
</script>
但它找不到报表查看器控件,它说:"无法获取未定义或空引用的属性'get_isLoading'"。
如果我使用 Web 窗体,它可以工作,但如果我使用内容页,具有主母版页和辅助母版页,则它不起作用。
有什么想法吗?
我通过在浏览器的源代码中搜索报表查看器 ID 找到了临时解决方案,这不是最好的解决方案,但它有效。
谢谢