4

I've a web project in VS2008. The problem is that from a web report viewer; report is not getting printed or exported to pdf. Report is being shown alright but when print button or export button is pressed, nothing happens. No errors or crash. Just nothing got happened. Default printer is set alright and I am able to print from that machine.. Am I missing some thing here???

Earlier when I installed the application in a new virtual directory report was not getting shown then I've copied aspnet_Client folder in my newly created web application root and the report was then made visible. However the print and export functionality is not working.

2 Answers 2

1

Are you maintaining state on the report document itself? I had to add my report to Session and reset the report source on page load.

    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
  • here what assembly deserving this class Constants.Session.Report. Apr 7, 2014 at 6:39
0

Are you using the report inside an UpdatePanel? If so, check that have placed 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 check that you have the ViewState enabled for the page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.