Handle post actions
You can handle the report processing post actions in following Report Viewer events to customize the rendered report.
RenderingBeginRenderingCompletedReportServiceRequestBeginEncryptCredentials
RenderingBegin
This event occurs when the report begins rendering. Information about this event is passed in a CancelEventArgs object to a CancelEventHandler delegate, which handles the event. You can use the following code in your application.
this.ReportViewer.RenderingBegin += async (sen, arg) =>
{
var dialog = new MessageDialog("This event handler will be called before the report rendering.");
await dialog.ShowAsync();
};RenderingCompleted
This event occurs when the report finishes rendering. Information about this event is passed in a RenderingCompletedEventArgs object to the RenderingCompletedEventHandler delegate, which handles the event. You can use the following code in your application.
this.ReportViewer.RenderingCompleted += async (sen, arg) =>
{
var dialog = new MessageDialog("This event handler will be called after complete the report rendering.");
await dialog.ShowAsync();
};ReportServiceRequestBegin
This event occurs when service request started for RDL processing mode to interact with web api for ReportViewer. You can use the following code in your application.
this.ReportViewer.ReportServiceRequestBegin += async (sen, arg) =>
{
var dialog = new MessageDialog("This event handler will be called before interact the report viewer web api services");
await dialog.ShowAsync();
};EncryptCredentials
Encrypt the report data source credentials and report server credential to pass the report viewer controller to render the report securely. You can use the following code in your application.
this.ReportViewer.EncryptCredentials += (sen, arg) =>
{
DataSourceCredentials credential = new DataSourceCredentials();
credential.Name = "<database>";
credential.UserId = "ssrs1";
credential.Password = "RDLReport1";
// Set the Report server credential and Data source credential for the report server reports.
arg.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
arg.DataSourceCredentials.Add(credential);
};