Can't create instance of Crystal Report

G

Guest

For my website, I created CrystalReportTest.rpt (through the designer in VS
2005) and I'd like to be able to display it in viewer.aspx (all in the same
project). Viewer.aspx has a Crystal Report viewer but for some reason, I
can't create an instance of this report. Therefore, I can't set any of its
properties. The only way I was able to run it was through:

CrystalReportViewer.ReportSource = Server.MapPath("CrystalReportTest.rpt");

Since I'm getting a Logon page everytime I open the page with the viewer
(which I don't want), I wanted to try the solution in
http://aspalliance.com/490, but that requires me to instantiate my report.
CrystalReportTest.rpt also doesn't have any code-behind (there are no other
files related to the rpt).
Any help is appreciated. Everything's done in VS 2005 framework 2.0

Thanks,
VMI
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


Why are you loading a report?

CR by default create a class with the same name than the report:

ReportDocument report = new CrystalReportTest();
CrystalReportViewer.ReportSource = report;
 
G

Guest

The report doesn't take any parameters, so I just figured it would be easier
to load the report once Viewer.aspx opens up.
Crystal Reports didn't create a class. Does it have to do with some type of
configuration when creating the report?
The problem is that it asks for login information when the report opens up.

Thanks.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


VMI said:
The report doesn't take any parameters, so I just figured it would be
easier
to load the report once Viewer.aspx opens up.
Crystal Reports didn't create a class. Does it have to do with some type
of
configuration when creating the report?

I find weird that CR did not create the class, did you try the code I posted
and see if it works?
The problem is that it asks for login information when the report opens
up.

This is a completely different matter, what is your data source? a dataset ?
a sql server?
 
G

Guest

I already found a possible solution to the login problem. But the solution
requires that I create an instance of the report, and I can't do that since
CR didn't generate a class for it.
The report doesn't have a datasource. Everything needed to run the report is
in the report. I just need to call it (I don't pass anything to it).

Thanks.
 

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