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

How to access the Report Parameters in HTML5 viewer report

4 Answers 235 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kunal Bagga
Top achievements
Rank 1
Kunal Bagga asked on 09 Jun 2014, 05:02 AM
Hi, 
I want to access the Report Parameters in the back end of the report (I am using HTML5 report viewer). As explained for the normal report I have tried accessing the parameters in NeedDataSource. But the value of the parameter is Null even in NeedDataSource. Can you guys explain me this. ? 

4 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 11 Jun 2014, 12:29 PM
Hi Kunal,

In general, in events you can access the running values of report parameters as illustrated in the Using Report Events article. Still we have considerations for modifying the report definition in events and recommend creating the report in such manner that data retrieval and changes (hiding/showing items, styling changes) to be controlled via report parameters, which can be changed on displaying a report.

Consider the example with an ObjectDataSource that wraps a data retrieval method, which controls the retrieved data via parameters mapped to report parameters - Using Parameters with the ObjectDataSource Component.

You can also use a custom report resolver, and modify the report or bind the data in its Resolve method. For more details check this forum post.

We will appreciate it if you let us know more details about the reason to use events and access report parameters in them.

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.

 
0
Kunal Bagga
Top achievements
Rank 1
answered on 12 Jun 2014, 09:48 AM
Hi Stef, 
In my problem, my objectDataSource can get the report parameters but when I try to access the value in the back end of the report either by NeedDatasource or ItemDataBound, the parameter value is null. 

These are the followings assignment that I did for the report
1. Visibility of the Report Parameter is false;
2. I have not set datasource for the report. But I set the objectDataSource for the table under the report
3. I am using Html5Report Viewer.





0
Accepted
Stef
Telerik team
answered on 16 Jun 2014, 03:35 PM
Hi Kunal,

Thank you for your update.

In events you can access the report parmaeters' running values by getting first the processing equivalent of the report, and then its Parameters collection e.g.:
void table_NeedDataSource(object sender, EventArgs e)
{
     var procTable = sender as Telerik.Reporting.Processing.Table;
     var procReport = procTable.Report as
Telerik.Reporting.Processing.Report;
    object processingParameterValue = procReport.Parameters["parameter1"].Value;
    procReport.DataSource = GetData(processingParameterValue);
}


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.

 
0
Kunal Bagga
Top achievements
Rank 1
answered on 23 Jun 2014, 06:43 AM
Ok thanks.. 
This gives me the exact result. 
Tags
General Discussions
Asked by
Kunal Bagga
Top achievements
Rank 1
Answers by
Stef
Telerik team
Kunal Bagga
Top achievements
Rank 1
Share this question
or