This is a migrated thread and some comments may be shown as answers.

Pass a parameter from ASP.NET page

1 Answer 184 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Saeid Kdaimati
Top achievements
Rank 2
Saeid Kdaimati asked on 25 Sep 2013, 06:57 AM
Hi

How can I pass a parameter value from ASP.NET page to a report displayed in a report viewer? Do you have a complete example for this scenario?

Thanx

1 Answer, 1 is accepted

Sort by
0
Saeid Kdaimati
Top achievements
Rank 2
answered on 27 Sep 2013, 06:25 AM
Ok, I found a solution:
1. During configuring the SQL datasource, at "Configure Data Source Parameters" step, make sure you select correct DbType for the parameter, for value select New Report Parameter.
2. On ASP.NET page that host Report Viewer, add this code:
//Create a new instance of the Report1
Telerik.Reporting.Report report1 = new Report1();
 
//Set a value to a Report Parameter, not to SQL parameter
report1.ReportParameters["ReportParameterName"].Value = int.Parse(Request.QueryString["value"].ToString());
 
//Assign the report to a report viewer
Telerik.Reporting.InstanceReportSource irs = new Telerik.Reporting.InstanceReportSource();
irs.ReportDocument = report1;
ReportViewer1.ReportSource = irs;
Tags
General Discussions
Asked by
Saeid Kdaimati
Top achievements
Rank 2
Answers by
Saeid Kdaimati
Top achievements
Rank 2
Share this question
or