Ok 我花了几个小时( 确切地说是4个小时) 来寻找解决办法。 我找到了一些结果, 但至今为止没有工作 。 () ( ) : ( ) ( ) @ info/ plain
问题 : 我有一个用户控制中的报告查看器, 我隐藏工具栏并创建了自己的工具栏。 现在, 我添加了一个应该打印的按钮, 但似乎无法让它工作 。 我会为我采取你们可能拥有的任何解决方案 。 但是它必须是个按钮, 而不是报表的默认栏 。
这是我的代码:
<rsweb:reportviewer
ID="rvReports"
runat="server"
Height="600px"
Width="600px"
ShowToolBar="False"
SizeToReportContent="True" AsyncRendering="false" />
<asp:ImageButton ID="btnprint" runat="server" ImageUrl="../img/print.png"
OnClientClick="PrintReport();" />
标注描述 :
<script type="text/javascript">
function PrintReport() {
var viewerReference = $find("rvReports");
var reportArea = viewerReference.get_reportAreaContentType();
if (reportArea == Microsoft.Reporting.WebFormsClient.ReportAreaContent.ReportPage) {
$find("rvReports").invokePrintDialog();
}
}
</script>
我犯的错误是:
Uncaught TypeError: Cannot call method get_reportAreaContentType of null
Just in case I added a Jquery Library cause I thought that was it but nothing doing.. BTW I got that javascript from here as it was one of the answers on another stackoverflow questions.