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

How to pass parameter from client to objectdatasource

3 Answers 179 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 23 Jan 2017, 05:45 AM

I have a MVC application and am trying to pass parameters from client side to objectdatasource.

The client code is like:

 @(Html.TelerikReporting().ReportViewer()
                      .Id("report-viewer1")
                      .ServiceUrl(Url.Content("~/api/reportservice/"))
                      .TemplateUrl(Url.Content("~/content/reportviewer/templates/telerikReportViewerTemplate.html"))

                        ....................

                     .ReportSource("report.trdp", new Dictionary<string, object>() { { "parameter1", "value1" }, { "parameter2", "value2" } })

                )

report.trdp is created with Reporting Designer.  it is configured to get the data from objectdatasource (binding to the extension assembly and function).

The question is: how can I pass "parameter1" and "parameter2" from the client side to the extension function at the server side to limit the data query?

3 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 23 Jan 2017, 05:33 PM
Hello Jerry,

You need to add the parameters in the report's ReportParameters collection on designing the report - How to: Add Report Parameters. These parameters can be used to filter data on retrieval or through the report's Filters - Filtering Data.
For example check the code in Connecting Telerik Reporting to OData feeds.

Then you can update the report parameters values by passing values through the viewer's ReportSource. The ReportSource.Parameters collection (the dictionary) will be mapped by key (case sensitive Name) to the report's ReportParameters collection.
Visible parameters can be updated further through the viewer's parameters area.
Hidden parameters can be updated in Javascript e.g. How To: Pass Values to Report Parameters (step 7)

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jerry
Top achievements
Rank 1
answered on 30 Jan 2017, 12:39 AM
Thanks Stef.  You are quite helpful
0
Jerry
Top achievements
Rank 1
answered on 30 Jan 2017, 12:40 AM
thanks. I worked out with your suggestions.
Tags
General Discussions
Asked by
Jerry
Top achievements
Rank 1
Answers by
Stef
Telerik team
Jerry
Top achievements
Rank 1
Share this question
or