views:

74

answers:

2

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.

A: 

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

Eduardo Molteni
A: 

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;

        }

}

bulltorious