VS2008 CR report viewer. Printing and exporting to PDF does not work

I have a web project in VS2008. The problem is that of viewing web reports; the report is not printed or exported to pdf. The report displays well, but when the print button or export button is pressed, nothing happens. No errors or crashes. Nothing just happened. The default printer is configured well, and I can print from this machine .. Did I miss something here?

Previously, when I installed the application in a new virtual directory, the report did not appear, I copied the aspnet_Client folder to my newly created root web application, and the report became visible. However, the print and export function does not work.

+4
source share
2 answers

Do you maintain state in the report document itself? I had to add a report to Session and reset the report source when the page loaded.

ReportDocument report = new ReportDocument(); report.Load(Server.MapPath("blargh.rpt")); //... rptViewer.ReportSource = report; 

Session [Constants.Session.Report] = report;

 protected void Page_Load(object sender, EventArgs e) {//detects wether or not the RepoerViewer should be displayed again, to avoid it displaying an empty modal box. if (hdfDisplayCrystalReport.Value == "Yes") { rptViewer.ReportSource = (ReportDocument)Session[Constants.Session.Report]; } if (rptViewer.ReportSource == null) { hdfDisplayCrystalReport.Value = string.Empty; } 

}

+1
source

Are you using the report inside UpdatePanel? If so, be sure to set the trigger inside the panel:

 <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" DisplayGroupTree="False" oninit="CrystalReportViewer1_Init" /> </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="CrystalReportViewer1"/> </Triggers> </asp:UpdatePanel> 

Also make sure you have a ViewState for the page

0
source

Source: https://habr.com/ru/post/1305351/


All Articles