Report With parameter.

mohanarajmohanaraj 600001
edited October 2009 in FastReport .NET
Daer all,

I'm using fastreport.Net for ASP.Net. I want to display the From date and To date in the report for that i add the new parameter by click in the parameter label present in the fastreport designer's Data panel and rename it to "Company_Name", "FromDate" and another one as "ToDate" then i save the file.

In the .cs file i write the code to pass the value to that parameter as below


if (!IsPostBack)
{
from = commonObjects.From;
to = commonObjects.To;
weekend = commonObjects.Weekend;
}
if (AllcallDetails.ReportFile == String.Empty)
{

AllcallDetails.ReportFile = Server.MapPath("~\\App_Data\\AllCall.frx");
AllcallDetails.Report.SetParameterValue("Company_Name", Session["TableName"].ToString());
AllcallDetails.Report.SetParameterValue("FromDate", from);
AllcallDetails.Report.SetParameterValue("ToDate", to);

AllcallDetails.Prepare();
}
protected void AllcallDetails_StartReport(object sender, EventArgs e)
{
Report FReport = (sender as WebReport).Report;
RegisterData(FReport);
}



When i run the report application it produce error in the bolded lines. But the Session["TableName"].ToString(), from, to variables are having value.

Please advice me to do.
Thanks in advance.

Comments

  • edited 7:47AM
    Hello,

    You should use AllcallDetails_StartReport event handler to access the report. Move all code to this handler.
  • mohanarajmohanaraj 600001
    edited 7:47AM
    AlexTZ wrote: »
    Hello,

    You should use AllcallDetails_StartReport event handler to access the report. Move all code to this handler.



    Thanks It works fine.

Leave a Comment