Yet Another ReportSource to InstanceReportSource

8 posts, 0 answers
  1. Maxine
    Maxine avatar
    4 posts
    Member since:
    Sep 2012

    Posted 15 Oct 2012 Link to this post

    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
      
    }
      
    }

     

     

     

  2. IvanY
    Admin
    IvanY avatar
    417 posts

    Posted 17 Oct 2012 Link to this post

    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!

  3. Maxine
    Maxine avatar
    4 posts
    Member since:
    Sep 2012

    Posted 17 Oct 2012 Link to this post

    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;
      
    }
      
    }
  4. IvanY
    Admin
    IvanY avatar
    417 posts

    Posted 18 Oct 2012 Link to this post

    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!

  5. Raji
    Raji avatar
    8 posts
    Member since:
    Jun 2017

    Posted 16 Jun in reply to IvanY Link to this post

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

    give solution for it

  6. Stef
    Admin
    Stef avatar
    3611 posts

    Posted 16 Jun Link to this post

    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
  7. Raji
    Raji avatar
    8 posts
    Member since:
    Jun 2017

    Posted 16 Jun in reply to Stef Link to this post

    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"

  8. Stef
    Admin
    Stef avatar
    3611 posts

    Posted 19 Jun Link to this post

    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
Back to Top