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
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
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
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.
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.