Problem: I am trying to pass a Report Parameter value from the query string on the page to my report that already has the parameter defined. I just can't seem to get the value passed all the way to the report.
Telerik.Reporting.Report report = new MyCustomReportLibrary.TelerikReport();
report.ReportParameters["parameterName"].Value = Request.QueryString["Id"];
ReportViewer.Report = report;
This syntax above is fine but when the variable "report" is created by the TelerikReport() constructor it doesn't have a value for the parameter yet and when I set it after the fact it doesn't seem to matter. Even if I try to call a ReportViewer.RefreshReport().
Places I have looked:
Thanks for the help,
Chris
I was able to get it to work by altering the Contructor for MyCustomReportLibrary.TelerikReport. Hope this helps anyone looking for the answer.
Much like this example Telerik Forums | Pass Report parameters from Rad window to a telerik report
Telerik Report Code (TelerikReport.cs)
public TelerikReport(int Id)
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
this.ReportParameters["parameterName"].Value = Id;
}
ASP.Net Page Code (ReportViewerPage.cs)
protected void Page_Load(object sender, EventArgs e)
{
Report raReport = new TelerikReport(Request.QueryString["Id"] as int);
ReportViewer1.Report = raReport;
}