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

How to bind report document to new HTML 5 report viewer?

2 Answers 344 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ming
Top achievements
Rank 1
Ming asked on 04 Jan 2016, 12:01 AM

Hi guys,

I am glad to see that Telerik has released a new version of report viewer based on HTML 5. However, I hit a technical issue when I try to start using new version of Telerik report viewer.

Okay, let me talk about what I want to do with Telerik.

1. On back-end, I have built a custom reporting service in WCF, which will be implementing advanced business logic. You can think that I will do below steps on back-end in general. 

     a. Bind data to report - Receive UI request and load proper data for a report. I assume that report is a very basic report which doesn't has any sub-report, groups and other advanced features. 

     b. Render a report - Contact Telerik reporting engine to render a report. 

     c. Response - Send result to UI 

2. On front-end, I have built a MVC web project for displaying reports. But I don't want to use ASPX to display reports. Okay,instead of using aspx and Iframe, I want to use new version of HTML 5 report viewer and RESTFUL service (Personally, I don't like Teleirk restful service but I have to use it if there is no way to use HTML 5 report viewer without restful service). My questions shows as below:

 

Q1: After I sent the report result to UI, how to feed the reportSourceData or we say, report object, to HTML5 report viewer? In an old way, I used aspx page to do the data binding and displaying a report. Is there any small demo or steps to show me how to use new report viewer to display report without using Telerik restful service? If answer is no, please look at next question.

 

Q2: In my opinion, Telerik restful service seems like a build-in reporting engine which could be a black box. I don't have full control on restful service or we say its not easy to get full control on restful service. I think restful service may does similar things like my backend service does. If so, I believe there is a way to feed a report result to html 5 report viewer ? Can you please send me demo code to show me how to do that pls?

 

Thank you.

F9

 

 

2 Answers, 1 is accepted

Sort by
0
Ming
Top achievements
Rank 1
answered on 04 Jan 2016, 12:31 AM

According to this link. http://www.telerik.com/help/reporting/mvc-report-viewer-reportsource-model-binding.html

when you are using the MVC wrapper you can actually pass the report source created by you instead of typing a string. If your scenario is more complex there is a fallback option which lets you use a string, but that is in case you are using XmlReportSource or InstanceReportSource and you can resolve your reports in the REST service using your own algorithm.

@ModelType Telerik.Reporting.UriReportSource

@(Html.TelerikReporting().ReportViewer()

       .Id("reportViewer1")
       .ServiceUrl("/api/reports/")
       .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html")
       .ReportSource(Model)
       .ViewMode(ViewMode.Interactive)
       .ScaleMode(ScaleMode.Specific)
       .Scale(1.0)
       .PersistSession(false)
)

So the model must be the report resource object which means it can be XmlReportSource or InstanceReportSource.

Can I pass report ID to a custom report resolver and contact my backend service to create InstanceReportSource and return ReportSource to Html.TelerikReporting().ReportViewer() for displaying reports? 

0
Hinata
Top achievements
Rank 1
answered on 06 Jan 2016, 09:49 AM

Hi Alex

As you mentioned, you can manually resolve your reports in the REST service using your own code. So yes, you can pass just an ID and contact the backend service in the custom report resolver. (http://docs.telerik.com/reporting/telerik-reporting-rest-custom-report-resolver)

Tags
General Discussions
Asked by
Ming
Top achievements
Rank 1
Answers by
Ming
Top achievements
Rank 1
Hinata
Top achievements
Rank 1
Share this question
or