Unable to navigate Crystal Report

G

Guest

I am using Visual Studio 2005 Professional edition and built in CR version
10.2.3600.0 to create a web application.

The front-end to the report is written in C#. Basically Report.aspx creates
the datasets that the report needs then creates an instance of the strongly
typed report then passes the populated dataset to the report then sets the
report viewer to the report object.

When the application is run, the report is created just fine, but when I
click on any of the Crystal Reports toolbar functions such as next, print
....etc the page goes blank.

What should I do? Thanks in advance

Alex
 
J

jehugaleahsa

We have an expression at work: "Yay, Crystal!"

The problem is that you are not storing the Crystal Report in a
session. One of the hardest thing to do is make sure the report stays
around between postbacks.

You essentially write your code so that it either pulls from the
session or it creates a new one. Once you create it, it is not such a
big deal.

But, yeah, they didn't make it easy to maintain the report across
postbacks. It would have been nice if the report viewer managed it for
you (or if it could be made AJAX-enabled).

private static object ReportSource
{
get
{
const string CRYSTAL_SOURCE = "___CRYSTAL_SOURCE_SESSION_ID";
if (HttpContext.Current.Session[CRYSTAL_SOURCE"] == null)
{
HttpContext.Current.Session[CRYSTAL_SOURCE"] =
getReportSource(); // gets your report source
}
return HttpContext.Current.Session[CRYSTAL_SOURCE"];
}
}

Then you can use it like this:

void Page_Load(object sender, EventArgs e)
{
crystalReportViewer1.ReportSource = ReportSource; // automatically
generates the report if necessary
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top