问题描述
我在 ASPX 网站中使用 ReportViewer 版本 15。我想隐藏 ReportViewer 工具栏 (ShowToolBar = "false"),但这样做时,我无法再使用我的自定义按钮触发打印对话框。这是用于调用打印对话框的 JavaScript 代码。在早期版本的 ReportViewer 中,我能够隐藏工具栏并仍然使用 invokePrintDialog 函数,但这似乎不再起作用。
function PrintReport() {
var viewerReference = $find("MainReportViewer");
var stillonLoadState = viewerReference.get_isLoading();
if (!stillonLoadState) {
var reportArea = viewerReference.get_reportAreaContentType();
if (reportArea == Microsoft.Reporting.WebFormsClient.ReportAreaContent.ReportPage) {
$find("MainReportViewer").invokePrintDialog();
}
}
return false;
}
我现在正在做的是检查间隔是否存在类“ToolBarBackground”的 div,然后向其中添加 style="display: none"。不过,这似乎不是一个很好的方法(至少因为用户可以在很短的时间内看到工具栏,然后才会被隐藏)。
var checkExist = setInterval(function() {
if ($('.ToolBarBackground').length) {
$(".ToolBarBackground").css("display","none");
}
},100);
如果新报表查看器的工具栏被隐藏,有谁知道如何触发打印对话框?提前致谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)