I have a pop-up web page that shows Product information and have added a print button to the page that allows the user to print this info. I do not want a report viewer to show when the user clicks this Print button, just open the print dialog, user makes choices and then prints the report.
I have the report viewer on the same page that shows the Product Information in a hidden <div> tag, like this:
| <div style="display:none;"> |
| <telerik:ReportViewer ID="ReportViewer1" runat="server"> |
| </telerik:ReportViewer> |
| </div> |
All default properties have been taken for the ReportViewer, nothing has been changed. The report datasource is set in the code-behind (see code below).
When the user clicks on the Print button this is the code that is executed:
| Protected Sub btnPrint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrint.Click |
| Try |
| Me.ReportViewer1.Report = New ShowPartInfoRpt |
| Me.ReportViewer1.Report.DataSource = Me._ProductInfo |
| Dim printScript = String.Format("{0}.PrintReport();", Me.ReportViewer1.ClientID) |
| Me.ClientScript.RegisterStartupScript(Me.GetType(), "ReportPrint", printScript, True) |
| Catch ex As Exception |
| 'Generic error handling routine here, not shown |
| End Try |
| End Sub |
So I am setting the report viewer source to the report, then set the datasource for the report to a datatable. This datatable has 1 row in it. I have stopped the code in debug mode and see the values in the datatable. When the print dialog appears, the adobe preview window shows nothing, and printing the report prints a blank report.
What am I missing?
Thanks!