Crystal Report with parameter problem -Pls help

  • Thread starter Kapil Shah via DotNetMonster.com
  • Start date
K

Kapil Shah via DotNetMonster.com

Hello everybody,
I am trying to create a web application to generate Crystal Report with
Parameters. However I noticed that
ReportDocument.Load is used twice when the parameter page is loaded .
1) The first time ReportDocument.Load is used when the Crystal Report is
loaded and the parameter page is created.
2) The second time the ReportDocument.Load is again used when the user
enters the parameters in the parameters page.
My problem is I do not want the ReportDocument.Load to be used twice along
with the Parameter table . Would be greatful if anyone can help me with any
solution. The code is written below.. I have also used the post back method
but gives an error that object Report document not instantiated.




private void Page_Load(object sender,System.EventArgs e)
{
(if(!Page.IsPostBack)

string reportname= "C:\ReportWithParameter.rpt"
LoadReportName(reportname)
)



}


private void LoadReport(string reportName)

{
crDoc=new CrystalDecisions.CrystalReports.Engine.ReportDocument();
crDoc.Load(reportName);

CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
crParamFieldDefinitions = crDoc.DataDefinition.ParameterFields;


// create the table to hold the controls
Table table = new Table();
table.Width = 300;
table.BorderWidth=1;
table.BackColor = Color.LightGray;
table.BorderColor = Color.Gray;
table.CellSpacing = 10;
// table.GridLines = GridLines.Horizontal;
string paramName;

TableRow summaryRow = new TableRow();
TableCell summaryCell = new TableCell();


ParamTable.Rows[0].Cells[0].Controls.Add(table);

Session["Report"] = crDoc;
}

}


Pls guide...

Rahil
 
E

Elton Wang

Hi Kapil,

From your code, I can't find ReportDocument load twice.
Could you give more info?

Elton Wang
(e-mail address removed)

-----Original Message-----
Hello everybody,
I am trying to create a web application to generate Crystal Report with
Parameters. However I noticed that
ReportDocument.Load is used twice when the parameter page is loaded .
1) The first time ReportDocument.Load is used when the Crystal Report is
loaded and the parameter page is created.
2) The second time the ReportDocument.Load is again used when the user
enters the parameters in the parameters page.
My problem is I do not want the ReportDocument.Load to be used twice along
with the Parameter table . Would be greatful if anyone can help me with any
solution. The code is written below.. I have also used the post back method
but gives an error that object Report document not instantiated.




private void Page_Load(object sender,System.EventArgs e)
{
(if(!Page.IsPostBack)

string reportname= "C:\ReportWithParameter.rpt"
LoadReportName(reportname)
)



}


private void LoadReport(string reportName)

{
crDoc=new CrystalDecisions.CrystalReports.Engine.ReportDocument();
crDoc.Load(reportName);

CrystalDecisions.CrystalReports.Engine.ParameterFieldDefin
itions
crParamFieldDefinitions = crDoc.DataDefinition.ParameterFields;


// create the table to hold the controls
Table table = new Table();
table.Width = 300;
table.BorderWidth=1;
table.BackColor = Color.LightGray;
table.BorderColor = Color.Gray;
table.CellSpacing = 10;
// table.GridLines = GridLines.Horizontal;
string paramName;

TableRow summaryRow = new TableRow();
TableCell summaryCell = new TableCell();


ParamTable.Rows[0].Cells[0].Controls.Add(table);

Session["Report"] = crDoc;
}

}


Pls guide...

Rahil
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top