Last post Apr 02, 2011 11:14 AM by Stevishere
Mar 16, 2007 01:09 AM|the_man_is_hot|LINK
I have the following issue. I have about 15 crystal reports that i have. I want to create 1 "ViewReports" page where the user can choose what report they want to view by clicking on a button.
After the user clicks on the button, that will load the appropriate .rpt file into the ReportViewer that i have on my page thus giving the user the report that they wanted.
2 things that I need to know.
1. Here is the following code C# based on when one of the buttons is clicked. This button (the cmdProsects button) is clicked and is supposed to fire off the Prospects.rpt file in the ReportViewer1 crystal reports viewer object on the page.
Classes i'm referencing:
protected void cmdProspects_Click(object sender,
cmdProspects.Visible = false;
ReportViewer1.Visible = true;
ReportViewer1.Load = ("c:\\Reports\\Prospects.rpt");
When I go to compile my code the project bombs on me. I've tried a few different ways of loading the report however none have worked. If someone could give me the correct syntax that would be great.
2. Once I get the report loaded into the CrystalReports Viewer the "Export to file" feature that is there when running the .rpt files within Crystal is available correct?
Thanks in advance everyone.
Ryan J. Boyle
Apr 02, 2011 11:14 AM|Stevishere|LINK
Try putting this in your cmdProspects_Click :
int cID = Convert.ToInt32(ddItemCtgySel.SelectedValue.ToString);
//Set instances for input parameter 1 - @Dept
paramField.Name = "@ItemCtgyID";
//*Remember to reconstruct the paramDiscreteValue and paramField objects
paramDiscreteValue.Value = cID;
//Add the paramField to paramFields
crvCtlgItms.ParameterFieldInfo = paramFields;
//Load the report by setting the report source
crvCtlgItms.ReportSource = reportDocument;
//set the database loggon information.
Session("MyReport") = reportDocument;