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
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!
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;
}
}
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!
cannot implicitly convert type 'Telerik.Reporting.TypeReportCourse' to 'Telerik.ReportViewer.Html5.WebForms.ReportSource'
give solution for it
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
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"
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
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.
Hi Pabricio,
If I understood correctly, you would like to display the report through our Html5 WebForms ReportViewer. The easiest way is by using the Telerik Web Forms Report Viewer Form Item Template.
If you don't need to make any modifications of the report runtime, you can use TypeReportSource:
TypeReportSource typeReportSource = new TypeReportSource();
typeReportSource.Type = "Telerik.Reporting.Examples.CSharp.ReportCatalog, CSharp.ReportLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" ;
this.reportViewer1.ReportSource = typeReportSource;
Still, if you want to use IntanceReportSource, you need to implement CustomReportSourceResolver.
Note that this code is used to export the report to PDF programmatically:
ReportProcessor reportProcessor = new ReportProcessor();
InstanceReportSource instanceReportSource = new InstanceReportSource();
instanceReportSource.ReportDocument = MyReport;
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
If you don't need such a functionality, I would recommend removing this part of the code.
Neli,
There is a error in your code: 'TypeReportSource' does not contain a definition for 'Type'.
typeReportSource.Type = "Telerik.Reporting.Examples.CSharp... ";
Hi Ildar,
I would like to apologize for the misunderstanding. The property ifs TypeName. However, for the WebForms viewer, you need to use an instance of Telerik.ReportViewer.Html5.WebForms.ReportSource. I attached a sample project that demonstrates the approach.