Consuming .trdx files in ASP.NET MVC application

2 posts, 0 answers
  1. Klaus
    Klaus avatar
    4 posts
    Member since:
    May 2012

    Posted 21 Oct 2014 Link to this post

    When defining the HTML5 report viewer, one can either specify a TypeReportSource or UriReportSource as follows:

    [code language="csharp"]
     .ReportSource(new TypeReportSource() { TypeName = typeof(ReportCatalog).AssemblyQualifiedName })
    [/code]

    When using the TypeReportSource I see all the reports defined within the assembly containing ReportCatalog.

    My RESTFul report service is configured to return an instance of ReportTypeResolver as shown below:

    [code language="csharp"]
        public class ReportsController : ReportsControllerBase
        {
            // GET: Reports
            //public ActionResult Index()
            //{
            //    return View();
            //}

            protected override IReportResolver CreateReportResolver()
            {
               // var reportsPath = HttpContext.Current.Server.MapPath("~/ReportDefinitions");
                //return new ReportFileResolver(reportsPath);
                //  .AddFallbackResolver(new ReportTypeResolver());

                // use this for Visual Studio reports
               return  new ReportTypeResolver();
            }


    [/code]

    If I was going to use the standalone report designer to create the reports and drop all report definitions in a folder named ReportDefinitions in my ASP.NET MVC project, how do I present this in the same catalog manner as if I was using the TypeReportSource?

    I tried returning an instance of ReportFileResolver(reportsPath) as indicated in the commented section of the code without FallBack, setting the ReportSource of the report viewer to UriReportSource but the report viewer gives an error.



  2. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 24 Oct 2014 Link to this post

    Hi Klaus,

    In general, the HTML5 Report Viewer is a client-side widget served by a running Reporting REST service, which is dedicated to work with the viewer. It is the service that manages the report state and resources. More details how the viewer and the service work, and how to set them in a project are available in this forum thread.

    When you want to display a TRDX file, you need to use a ReportFileResolver, where you need to specify the folder on the server that contains the TRDX files.

    You can also test our local demos installed by default under C:\Program Files (x86)\Telerik\Reporting <VERSION>\Examples.
    The MvcDemo and Html5Demo projects use the folder with TRDX files installed with the Standalone Report Designer.


    Also, you can use Fiddler and record the requests from the viewer to the service in a log file. In Fiddler - Inspectors - Request/Response - Raw tabs you can see the request and the response content, and any errors that occur.


    If you need further help, feel free to open a support ticket and send us the log file created by Fiddler and a demo project which illustrates your settings.

    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.

     
Back to Top