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

Yet Another ReportSource to InstanceReportSource

8 Answers 392 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Maxine
Top achievements
Rank 1
Maxine asked on 15 Oct 2012, 06:19 PM
I'm trying to incorporate the new InstanceReportSource into an existing program that I've inherited.  I understand the Visual Basic examples given, but I'm stymied how to apply it to a C# program that is using interfaces.  Using the older version of Telerik that came with the program, the code will compile and run (although the designer won't come up).  Upon upgrading to the latest release of Telerik reporting, I've gotten the designer to come up on some of the reports.  However, I've got a few that are flagging errors about the deprecated RecordSource.  Therein is my confusion.  My attempts to incorporate the InstanceReportSource seems to result in more errors and I'm at a loss.  I did submit a trouble ticket when I was first intially using the trial version.  The end result was to "use the Instance Report Source".

I'm currently using Telerik Q2 2012 SP1, Visual Studio C# 10.0.30319.1 and .NET 2010 4.0.30319

In addition to the code listed below, I've also included a screen shot of the error message(s).   Any help or direction you could provide would be greatly appreciated.  Many Thanks!! 

 

namespace Reports 
  
 {
  
 using System; 
  
 using System.ComponentModel; 
  
 using System.Drawing; 
  
 using System.Windows.Forms; 
  
 using Telerik.Reporting; 
  
 using Telerik.Reporting.Drawing; 
  
   
  
/// <summary> 
  
 /// Summary description for Conservation2VacuumReport. 
  
 /// </summary> 
  
 public partial class ConservationPressureReport : Telerik.Reporting.Report, IStandardReport 
  
 {
  
 public ConservationPressureReport() 
  
 {
  
/// <summary> 
  
/// Required for telerik Reporting designer support 
  
/// </summary> 
  
 InitializeComponent();
  
// 
  
 // TODO: Add any constructor code after InitializeComponent call 
  
 // 
  
 }
  
  
  
#region IStandardReport Members 
  
 ProjectReport IStandardReport.ProjectReport 
  
 {
  
get { return this.ProjectReport.ReportSource as ProjectReport; } 
  
 }
  
   
  
TankReport IStandardReport.TankReport 
  
 {
  
get { return this.TankReport.ReportSource as TankReport; } 
  
 }
  
ISO283Report IStandardReport.isoReport 
  
 {
  
get { return isoReport.ReportSource as ISO283Report; } 
  
 }
  
 public bool iso283Visible 
  
 {
  
 get 
{
return isoReport.Visible; 
  
}
  
   
  
set 
  
 {
  
isoReport.Visible = value; 
  
 }
  
}
  
   
  
VacuumReport IStandardReport.vacuumReport 
  
 
  
 get { return this.VacuumReport.ReportSource as VacuumReport; } 
  
 }
  
#endregion
  
}
  
}

 

 

 

8 Answers, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 17 Oct 2012, 02:44 PM
Hello Maxine,

Thank you for the provided code snippet. Since the introduction of Report Sources things have changed a little bit and for example the Report Viewers will now work with report sources instead of simple reports. Therefore what you have to do in your case is to cast the ReportSource to InstanceReportSource and get the ReportDocument which is the actual report. Consider the following code snippet:
var reportSource = (Telerik.Reporting.InstanceReportSource)this.ProjectReport.ReportSource;
var report = (Telerik.Reporting.Report)reportSource.ReportDocument;
 
return report;

I hope that helps.

Kind regards,
IvanY
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Maxine
Top achievements
Rank 1
answered on 17 Oct 2012, 04:20 PM
IvanY

Thanks for the snippet.  Is there something else that might be missing?  When I compile the code the error I now get "Cannot implicitly convert type 'Telerik.Reporting.Report' to 'Reports.ProjectReport'. An explicit conversion exists (are you missing a cast?)"

With the code snippet, we are casting the ReportSource to the InstanceReportSource.  Did I misunderstand and not put the statement in the correct location?  (See attached snippet)

ProjectReport IStandardReport.ProjectReport
  
{
  
get
  
//return this.ProjectReport.ReportSource as ProjectReport; 
  
var reportSource = (Telerik.Reporting.InstanceReportSource)this.ProjectReport.ReportSource;
  
var report = (Telerik.Reporting.Report)reportSource.ReportDocument;
  
return report;
  
}
  
}
0
IvanY
Telerik team
answered on 18 Oct 2012, 08:27 AM
Hello Maxine,

We will need additional information about your classes and interfaces (such as ProductReport and IStandartReport) - we need to be aware of your exact inheritance structure in order to advise you accordingly.

Regards,
IvanY
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Raji
Top achievements
Rank 1
answered on 16 Jun 2017, 05:46 AM

cannot implicitly convert type 'Telerik.Reporting.TypeReportCourse' to 'Telerik.ReportViewer.Html5.WebForms.ReportSource'

give solution for it

0
Stef
Telerik team
answered on 16 Jun 2017, 07:30 AM
Hi Raji,

If you are using the HTML5 Viewer, the client-side report source must providea short string desription what server-side ReportSource to be produced by the Reporting REST Service. An InstanceReportSource is a server-side ReportSource that cannot be used at the client.

For more details, examples and solution, please check How to Set Report Sources For Report Viewers operating via Telerik Reporting Services.

Regards,
Stef
Progress 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
Raji
Top achievements
Rank 1
answered on 16 Jun 2017, 09:59 AM

what is identifier ? i got identifier issue can you tell how to set identifier?

 

what is this?

Identifier="Telerik.Reporting.Examples.CSharp.ProductCatalog, CSharp.ReportLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

0
Stef
Telerik team
answered on 19 Jun 2017, 03:38 PM
Hello Raji,

Please check the details and the examples in How to Set Report Sources For Report Viewers operating via Telerik Reporting Services.

The WebForms wrapper of the HTML5 Viewer has a client-side report source that can be set in code:
var clientReportSource = new Telerik.ReportViewer.Html5.WebForms.ReportSource();
clientReportSource.IdentifierType = IdentifierType.TypeReportSource;
clientReportSource.Identifier = typeof(ReportCatalog).AssemblyQualifiedName;//or <namespace>.<class>, <assembly> e.g. "MyReports.Report1, MyReportsLibrary"
clientReportSource.Parameters.Add("Parameter1", 123);
reportViewer1.ReportSource = clientReportSource;

The identifier type specifies if you are working with reports created in Vs Report Designer, or TRDP|TRDX file created by the Standalone Report Designer. If it is a custom identifier, this implies that on the server you are handling manually the string description of the report (the Identifier).

If you are requesting a report created by the Standalone Report Designer, the Identifier is a relative path to the TRDX|TRDP file that will be searched in the ReportFileResolver of the Reporting REST Service.

If you are requesting a report created by the VS Report Designer, the Identifier is the assembly qualified name of the report class - <namespace>.<report_class>, <assembly_name>.

Regards,
Stef
Progress 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
Pabricio
Top achievements
Rank 1
answered on 13 Mar 2018, 12:26 PM

Hi, I´m a problem to display my report in Telerik.ReportViewer.Html5.WebForms. I have report make in VS (Telerik.Reporting.Report), but I can´t convert it in report view. Can you help me?

This is my code:

ReportProcessor reportProcessor = new ReportProcessor();
InstanceReportSource instanceReportSource = new InstanceReportSource();

instanceReportSource.ReportDocument = MyReport;

RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);

Telerik.ReportViewer.Html5.WebForms.ReportSource reportSource = new Telerik.ReportViewer.Html5.WebForms.ReportSource();
reportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.TypeReportSource;
reportSource.Identifier = result.DocumentName.GetType().AssemblyQualifiedName;
            
tlViewer.ReportSource = reportSource;

I don´t get an erro. The report just don´t display. My form appear like a blank form.

Tags
General Discussions
Asked by
Maxine
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Maxine
Top achievements
Rank 1
Raji
Top achievements
Rank 1
Stef
Telerik team
Pabricio
Top achievements
Rank 1
Share this question
or