Skip to Content
author's profile photo
Former Member

Passing Parameter from ASPX to CR Viewer 2010


I am building a web application that uses Crystal Reports for products like invoices. I developed a report called CharterDetail.rpt that has a parameter {?TourID}.

From my web application we call the URL

which calls this View.aspx.cs page code.

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using CrystalDecisions.Shared;

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Web;

public partial class _Default : System.Web.UI.Page


private String reportPath = "C:

protected void Page_Load(object sender, EventArgs e)


String reportFile = Request.QueryString["rfn"];

String tourId = Request.QueryString["tourid"];

if (reportFile != "" && reportFile != null)


ReportDocument rd = new ReportDocument();

ParameterField pf = new ParameterField();

ParameterFields pfs = new ParameterFields();

ParameterDiscreteValue pdv = new ParameterDiscreteValue();

pf.Name = "@TourID";

pdv.Value = tourId;



CrystalReportViewer1.ParameterFieldInfo = pfs;

rd.Load(reportPath + reportFile);

CrystalReportViewer1.ReportSource = rd;




If I don't pass the {?TourID} parameter in the URL I am able to load the report and it prompts me for the input parameter. I enter the parameter and it displays properly.

If I include the parameter in the URL then I get an error in that says "The parmeter is incorrect"

I'm missing something fundamental. I believe I haven't got the report configured properly but have not been able to find a property that will make a difference . Any help is appreciated.


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Posted on May 04, 2011 at 01:31 PM

    Make sure you're on [SP1|] [original link is broken];

    Have a look at some parameter samples [here|]. Start with,,

    Also, there are a number of KBases you should be able to find using the search box in the top right corner of this web page. And don't forget to search the forums.

    - Ludek

    Add comment
    10|10000 characters needed characters exceeded