Page 1 of 1

ASP.NET + AngularJS

Posted: Sat Mar 24, 2018 9:36 pm
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,

Re: ASP.NET + AngularJS

Posted: Sun Mar 25, 2018 9:10 pm
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.

Re: ASP.NET + AngularJS

Posted: Sun Mar 25, 2018 9:32 pm
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.

Re: ASP.NET + AngularJS

Posted: Wed Mar 28, 2018 6:25 am
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.