Using Viewer Events
Our sample projects and report templates can help you learn the basics of working with our products.Set up the report viewer in .NET 8.0, load a template, and connect the component to the application.
Client-side events. Every viewer event is exposed as an Angular output. Bind your handlers with the
Two events are handled here:
Server-side handling. Interactive events that need the server are routed to the
Client-side events. Every viewer event is exposed as an Angular output. Bind your handlers with the
(event) syntax:export class AppComponent {
loaded(): void {
console.log('Report loaded');
}
export(event: any): void {
console.log(`Export to: ${event.exportFormat}`);
}
}<stimulsoft-viewer-angular
[requestUrl]="'/Viewer/{action}'"
[action]="'InitViewer'"
[height]="'100vh'"
(loaded)="loaded()"
(export)="export($event)">
</stimulsoft-viewer-angular>Two events are handled here:
(loaded) fires once the report has been rendered and is ready, and (export) fires when the user exports the report — the event object carries details such as the exportFormat. The same pattern works for other viewer events; simply bind the corresponding output.Server-side handling. Interactive events that need the server are routed to the
ViewerEvent action registered during initialization:[HttpPost]
public IActionResult ViewerEvent()
{
return StiAngularViewer.ViewerEventResult(this);
}