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

Add extension in ReportViewer

5 Answers 281 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Petr
Top achievements
Rank 1
Iron
Petr asked on 27 Jul 2015, 03:56 PM

Hello,

I create ReportViewer with report in my code and place it in Panel. In Javascript I start the printing by calling function PrintReport(). Something like that:

ReportViewer viewer = new Telerik.ReportViewer.WebForms.ReportViewer();
InstanceReportSource source = new InstanceReportSource();
source.ReportDocument = book;
viewer.ReportSource = source;
 
Panel retControl = new System.Web.UI.WebControls.Panel();
retControl.Controls.Add(viewer);

 

But I have the problem with the device information settings for rendering in PDF format. I define them in config file and it works fine, but I need to change them for some cases dynamicaly. I find that I can put hashtable with device info into RenderReport, but it looks there are not accessible any render methods in ReportViewer. Is it possible to these property in my program?

Many thanks

 

5 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 29 Jul 2015, 08:48 AM
Hi Petr,

Rendering extensions can be configured with different parameters by:
  1. Adding the settings in the application configuration file - settings are applied for all viewers in the application;
  2. Exporting programmatically with ReportProcessor instance, where settings are applied only for the currently processed report.

I hope the provided information is helpful.

Regards,
Stef
Telerik
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
Petr
Top achievements
Rank 1
Iron
answered on 29 Jul 2015, 09:12 AM

Hi Stef,

I know about these possibilities, but configuration file is used always the same and I need different setup for different users/browsers. I need to do it programmatically, but I don't have the ReportProcessor instance in my code. I use ReportBook, InstanceReportSource and ReportViewer. I expect that I can access ReportProcessor via ReportViewer, but I cannot find it. Is it possible?

Thanks
0
Stef
Telerik team
answered on 31 Jul 2015, 01:26 PM
Hi Petr,

You need to have a reference to Telerik.Reporting.dll to create an instance of the ReportProcessor. Then you can pass an InstanceReportSource that wraps the ReportBook - Exporting Report Programmatically.

The viewer must use a separate report source instance that wraps a separate ReportBook instance.

Regards,
Stef
Telerik
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
Petr
Top achievements
Rank 1
Iron
answered on 31 Jul 2015, 02:49 PM

You said that I need to use separate report source for viewer so it looks there is no possibility how to pass parameters to ReportViewer.

I don't use method ReportProcessor.RenderReport, but I create ReportViewer in my code and later method ReporViewer.PrintReport is called in Javascript. So it looks I must change the logic in my code and replace ReportViewer by ReportProcessor. Am I right?

Thank you

0
Accepted
Stef
Telerik team
answered on 04 Aug 2015, 03:06 PM
Hi Petr,

That is correct. The viewer will take into account only extensions' settings from the application's configuration file. If you need to control the extensions' settings per report, you will have to export programmatically the report instead of relying on the viewer's export capabilities.

Regards,
Stef
Telerik
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
Tags
General Discussions
Asked by
Petr
Top achievements
Rank 1
Iron
Answers by
Stef
Telerik team
Petr
Top achievements
Rank 1
Iron
Share this question
or