Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

UpatePanel - Crystal Report inside an UpdatePanel does not load on page refresh (.Net 4.0, VS2010, CRVS2010)

$
0
0

I am in the process of upgrading my web application. Here's the new configuration that I intend to use: Windows Server 2008 R2, IIS 7, Visual Studio 2010, IE 8, ASP.Net 4.0, Ajax for .Net 4.0, Crystal Reports for Visual Studio 2010

I have a Crystal Report inside an update panel of Ajax on an ASP.Net web page. The report loads fine the first time; but when I change the filter criteria, a page refresh happens and the page goes blank. All of this happens in VS2010 on my development machine.

I also checked the visibility of the report in my code and it is visible.

I checked this link and tried everything there too - http://scn.sap.com/community/crystal-reports-for-visual-studio/blog/2012/10/16/report-appears-blank-in-browser-after-deploying-a-crystal-reportsnet-web-application

I created my post on the SAP Crystal Reports forum and it can be found here: http://scn.sap.com/thread/3309337 . They could not provide a solution that worked for me.

Here's the code that I use to load the crystal report.

Note: This same code worked perfectly fine with .Net 2.0 and CR For VS2005.

====== HTML for Crystal Report Viewer =========

<!-- The below code is inside an Ajax UpdatePanel's TabContainer -->

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" HyperlinkTarget="_blank"
    ShowAllPageIds="True" Font-Bold="True" ToolbarStyle-CssClass="CRDisplayBar" EnableParameterPrompt="False"
    AutoDataBind="False" EnableDatabaseLogonPrompt="False" HasToggleGroupTreeButton="False"
    EnableDrillDown="False" ToolPanelView="None" ReuseParameterValuesOnRefresh="true" />

======= ASP.Net Code ========
protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
           scriptManager.RegisterPostBackControl(CrystalReportViewer1);
    SetReportViewerProperties(CrystalReportViewer1);
           
        }
        catch (Exception ex)
        {
            // Exception handling code
        }
    }


protected void SetReportViewerProperties(CrystalDecisions.Web.CrystalReportViewer crViewer)
    {
        ReportDocument rd = LoadReport(strReportName);

        if (rd.IsLoaded)
        {
            crViewer.Visible = true;
            crViewer.ReportSource = rd;
            Session["crViewer"] = crViewer;
        }
        else
        {
            crViewer.Visible = false;
        }

        crViewer.DisplayToolbar = true;
        crViewer.EnableParameterPrompt = false;
        crViewer.HasToggleGroupTreeButton = false;
        //crViewer.DisplayGroupTree = false;
        crViewer.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
        crViewer.HasCrystalLogo = false;
        crViewer.HasDrillUpButton = false;
        crViewer.HasRefreshButton = false;
    }


protected ReportDocument LoadReport(string reportPath)
    {
        //rd = new ReportDocument();
        try
        {
            if (Session["rd"] == null)
            {
                rd = new ReportDocument();
                Session["rd"] = rd;
            }
            else
            {
                rd = (ReportDocument)Session["rd"];
            }

     // Some custom code...

            rd.Load(Server.MapPath(reportPath)); // reportPath contains the path of the Crystal Report
     rd.SetDataSource(myCustomDataSet);           

        }
        catch (Exception e)
        {
            // Exception handling code
        }
        return rd;
    }

================================

<div class="jive-rendered-content">

Here’s what I have tried already...but all in vain :

  • Added a trigger to the update panel for the Crystal Report Viewer.
  • Added the crystalreportviewers13 folder in the aspnet_client >> system_web >> 4_0_30319.
  • Earlier had the Crystal Report inside a TabContainer control. Removing the TabContainer did not help.
  • Added the Crystal Report to the session and load it from the session on each postback.
  • Added CrystalReportViewer1.DataBind() to the code.
  • Added all the necessary assemblies for Crystal Reports in web.config.
</div>

Am I missing something?

Please let me know if more information is required.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>