How to use route and parameters in the report viewer?

1 Answer 159 Views
Report Viewer - ASP.NET
WoorimartDEV
Top achievements
Rank 1
Iron
Iron
WoorimartDEV asked on 01 Nov 2022, 05:07 AM | edited on 01 Nov 2022, 05:08 AM

Hi, support

 

I want to create a report viewer server and send a request from the website to url.

C:\Program Files (x86)\Progress\Telerik Reporting R2 2022\Examples\CSharp\.NET 6\Html5IntegrationDemo
I'm taking that into consideration
When I type http://localhost:51863/index.html, the screen appears, and the leaflet about the product is http://localhost:51863/goodsPop, and the information about people is http://localhost:51863/employee. I wonder what to do in this case.

            {
                endpoints.MapRazorPages();
                endpoints.MapControllers();
            });
            app.MapControllerRoute(
                name: "default",
                pattern: "{controller=Home}/{action=Index}/{id?}"
            );
            app.Run();
Should I add it to the Program.cs part like the code above and create a controller separately? Or is there any other way?



Also, we are going to send jsonData to the url in post format, and in this case, I wonder how to receive the value in the report viewer server and deliver it to the report.

And there are Html5IntegrationDemo and ReportingRestServiceCorsDemo in the folder of Net6, what is the difference between the two projects?


1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 03 Nov 2022, 03:45 PM

Hi Doyeong,

Let me start with the JSON data passed with a POST request. You may use the WebServiceDataSource in the Report, and it will fetch the data for you. You may find helpful also the article Using Parameters with the WebServiceDataSource component.

Regarding the difference between the  Html5IntegrationDemo and ReportingRestServiceCorsDemo:

The ReportingRestServiceCorsDemo is only a Reporting REST Service with enabled CORS and without a viewer. It is supposed to be used with viewers running in different domains, hence the enabled CORS. For example, by the Angular and React demos.

The Html5IntegrationDemo is a viewer with a service that doesn't have CORS enabled, as the viewer and the service are on the same domain.

I'm afraid I don't understand exactly the first question. If you want to create a Report Viewer and connect it to Telerik Reporting REST Service in .NET 6, here are the resources you need. The .NET 5 resources are generally applicable also for .NET 6:

Regards,
Todor
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
WoorimartDEV
Top achievements
Rank 1
Iron
Iron
commented on 04 Nov 2022, 09:22 AM

Hello
Thank you for your answer.

I'm going to make it like this.

A: Website (http://localhost:5001)
B: Report Viewer Server(http://localhost:5002)
when it comes to that,
If the user presses the print button to print out the POP on site A,
A sends a request to http://localhost:5002/pop/print, then B receives the request and puts the json data sent into the report.
And if you press the print button to print employee information, A sends a request to http://localhost:5002/employee/print, then B receives the request and puts the json data sent into the report.

[POP]
A----requestUrl [http://localhost:5002/pop/print] --->B
[Employee]
A----requestUrl [http://localhost:5002/employee/print] ---> B

I want to make it like this.
However, looking at the example of Html5Viewer, there are no other controllers besides the Report Controller and ReportDesigner Controller, so I am wondering if there is a separate part to set the route or if I need to create an additional controller in the Controllers folder.
Todor
Telerik team
commented on 09 Nov 2022, 08:57 AM

If I understood correctly, you need to pass data to your report and only print it. If so, you don't need a viewer or a Reporting REST Service.

You may use the ReportProcessor to render the report in PDF, with the necessary embedded JavaScript that invokes the PDF extension print dialog. For details, I suggest the KB article Print a report directly at the client-side without displaying it in a Viewer.

Tags
Report Viewer - ASP.NET
Asked by
WoorimartDEV
Top achievements
Rank 1
Iron
Iron
Answers by
Todor
Telerik team
Share this question
or