ASP.NET + AngularJS

Stimulsoft Reports.WEB discussion
Post Reply
BorisP
Posts: 2
Joined: Sat Mar 17, 2018 10:31 am

ASP.NET + AngularJS

Post by BorisP »

Hi,

I have to somehow show report in AngularJS application. Report is loaded on server side in ASP.NET application, in controller with code like this:

public IActionResult test_report()
{
var report = new StiReport();
report.Load(StiNetCoreHelper.MapPath(this, "Reports/test_report.mrt"));
return StiNetCoreViewer.GetReportResult(this, report);
}

How can I show this report in AngularJS page?

I have tried to send a view, from above controller a view is:

@Html.StiNetCoreViewer("StiMvcViewer1", new StiNetCoreViewerOptions()
{
Actions =
{
GetReport = Model,
ViewerEvent = "ViewerEvent",
DesignReport = "Design"
},
Appearance =
{
BackgroundColor = System.Drawing.Color.FromArgb(0xe8, 0xe8, 0xe8),
ScrollbarsMode = true
},
Toolbar =
{
DisplayMode = StiToolbarDisplayMode.Separated,
ShowDesignButton = false
},
Width = Unit.Percentage(100),
Height = Unit.Percentage(100)
})

So, I tried to return this view to AngularJS application and show output HTML, but nothing shows on page.

We cannot connect to database from client JavaScript. Any idea how to load a report on server side ASP.NET and show it in Angular application?

Thanks,
Lech Kulikowski
Posts: 7341
Joined: Tue Mar 20, 2018 5:34 am

Re: ASP.NET + AngularJS

Post by Lech Kulikowski »

Hello,

You can render your report on the server side and then send rendered document on the client.
In this case, on the client, you should use the loadDocument() method to load already rendered report to the viewer.

Thank you.
BorisP
Posts: 2
Joined: Sat Mar 17, 2018 10:31 am

Re: ASP.NET + AngularJS

Post by BorisP »

Lech Kulikowski wrote: You can render your report on the server side and then send rendered document on the client.
In this case, on the client, you should use the loadDocument() method to load already rendered report to the viewer.
Hi Lech,

Thank you for you your answer.

Any idea how to "render" document on server side, and load it with loadDocument() on the client (is that some JavaScript component)? I couldn't find an article on site about this issue.
Lech Kulikowski
Posts: 7341
Joined: Tue Mar 20, 2018 5:34 am

Re: ASP.NET + AngularJS

Post by Lech Kulikowski »

Hello,

On the server side (ASP.NET) you can render report and save it, something like:
StiReport report = new StiReport();
report.Load(reportPath);
report.RegData(data);
report.Render(false);
report.SaveDocument();

and then send this rendered report on the client side for the viewer where use loadDocument() method for loading rendered report.

Thank you.
Post Reply