Print Page | Close Window

Problem using Crystal Report .NET in ASP.NET

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2942
Printed Date: 04 May 2025 at 8:31am


Topic: Problem using Crystal Report .NET in ASP.NET
Posted By: fabu1971
Subject: Problem using Crystal Report .NET in ASP.NET
Date Posted: 16 Apr 2008 at 10:55am
I developed an ASP.NET web page using as object Crystal Report. I'm using multiview. After the report run, when I clicked Export or move to the next page, the web page goes blank. I tried in different ways to see the report. I have the following code:

protected void Page_Load(object sender, EventArgs e)
{ // Begin Page_Load

if (!Page.IsPostBack)
{ // Begin if
mvwReport.SetActiveView(viewParameterPrompt);
} // End if

} // End Page_Load

To open the report I have the following code:

CrystalReportViewer1.ParameterFieldInfo = myPFs;
CrystalReportViewer1.RefreshReport();
mvwReport.SetActiveView(viewReportOnDemand);

I don't understand why when I click any button of Crystal report the report goes blank. I hope that someone can help me to handle this issue. I appreciate any help or suggestion or idea.





Replies:
Posted By: BrianBischof
Date Posted: 16 Apr 2008 at 11:39am
I haven't used multiview with Crystal Reports before, but one thing you should be doing is putting your CR code in the Page_Init() event. Putting it in the page load event messes things up with viewstate and the report rendering and causes all kinds of problems with invalid report pages showing up. So I suggest reworking your code so that all reporting code is in Page_Init() and that will probably help you out a lot.

I cover different ways to work with the report object model in my Encyclopedia Vol 2 book. You can find out more about my books at  http://www.amazon.com/exec/obidos/ASIN/0974953601/bischofsystem-20 - http://members.crystalreportsbook.com - Crystal Reports eBooks online.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window