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

Can't add parameters to ReportViewer Report

3 Answers 331 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 28 Mar 2011, 10:21 AM
Hi,

I am new to Telerik report viewer. I am trying to pass parameters programmatically to a report viewer report on an asp.net web form. I found the article "Using Report Parameters programmaticall", but I can't see an ".add" function for the control.

ReportViewer1.Report.ReportParameters.


I also can't do: ReportViewer1.Report.ReportParameters["ManagerID"].Value = "123";

Can you please tell me what I am doing wrong.

Regards

Dave

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 31 Mar 2011, 10:56 AM
Hi Dave,

The Report property of the viewer(s) is of type IReportDocument which is a common interface for both Reports and ReportBooks. They, however, handle the report parameters differently.  You can work only with the ReportParameters collection of the Report instances so you should set their values before assigning the report instance to the Report property of the viewer.  Another approach is to explicitly cast the Report property of the viewer to Telerik.Reporting.Report. For example:

((Telerik.Reporting.Report)this.ReportViewer1.Report).ReportParameters["ManagerId"].Value = 5;

For more information about Telerik Reporting you can check out the Quickstart help articles and the videos at http://tv.telerik.com/. By default the videos are dedicated for beginners. Additionally you may read the Step by Step tutorial which is a good starting point to learn how to work with the Telerik Reporting tool.

All the best,
Peter
the Telerik team
0
Divya
Top achievements
Rank 1
answered on 18 Apr 2014, 04:21 AM
I am  also  new to Telerik report viewer. I am trying to pass parameters programmatically to a report viewer report on an asp.net web form.

ReportViewer1.Report.ReportParameters.


I also can't do: ReportViewer1.Report.ReportParameters["ManagerID"].Value = "123";

 i am passing in 123 place listitem selected value like convert.ToInt32(ddllist.selectedvalue)
but not showing report after clicking the button
parameters showing but not showing report
how to add reportviewer to parameters programtically

any code for this

0
Stef
Telerik team
answered on 18 Apr 2014, 10:00 AM
Hi Divya,

The ReportViewer.Report property is now obsolete, and you should use the ReportViewer.ReportSource property. Below you can find a quote from your support ticket on the same question and the sample project we sent you in the ticket:

You can find attached a sample project that illustrates how to pass a value to report parameter from external UI. This can be achieved through the Report Source object that wraps the report. The ReportSource.Parameters collection (key-value pairs) is mapped to the underlying Report.ReportParameters collection by key.

Using this approach you can pass also Session variable, as long as they are from the supported by the report parameters types: String, Integer, Float, Datetime, Boolean. You can also reassign the ReportViewer.ReportSource to other Report Source object.

Since you use AJAX, please check the supported AJAX scenarios. In addition, consider switching to the new HTML5 Report Viewer, which is entirely HTML5/CSS3/JS based widget, served by the Reporting REST service. You can check our local Html5Demo project to test the HTML5 Report Viewer - examples are installed by default under C:\Program Files (x86)\Telerik\Reporting Q1 2014\Examples\CSharp.


If you need more details, about the demo project and the suggested approach, please let us continue the discussion in the mentioned support ticket #806737 in order to keep a better track on the exchanged information and files.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Dave
Top achievements
Rank 1
Answers by
Peter
Telerik team
Divya
Top achievements
Rank 1
Stef
Telerik team
Share this question
or