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 11:15AM
    Hello,

    You should use AllcallDetails_StartReport event handler to access the report. Move all code to this handler.
  • mohanarajmohanaraj 600001
    edited 11:15AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.