Local Processing of RDLC File Using AspNetReportViewer Wrapper



Taken from here.

Hello Luca, I managed to understand the Wrapper, and I am playing with it now. I managed to change the wrapper so that I can execute local report with playing with ServerUrl parameter, so now local report shows up. if (this.ServerUrl == “file”) { viewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; viewer.LocalReport.ReportPath = this.ReportPath; } else { viewer.ServerReport.ReportPath = this.ReportPath; viewer.ServerReport.ReportServerUrl = new Uri(this.ServerUrl); viewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote; if (!this.IsPostBack && this.UserName != null) viewer.ServerReport.ReportServerCredentials = new ReportViewerCredentials(this.UserName, this.Password, this.DomainName); } but I am missing options to adjust specifics for local report set report parameters: ReportParameter rptParam = new ReportParameter(“rptParameter”, “some text”); reportViewer1.LocalReport.SetParameters(rptParam); I would need to have option to set ReportDatasource, this can be done in wrapper, but I need to do it on the Window itself as I need to show multiple reports: ReportDataSource myReportSource1 = new Microsoft.Reporting.WebForms.ReportDataSource(“rptDatasource”, datasource); reportViewer1.LocalReport.DataSources.Add(myReportSource1); //reportViewer1.LocalReport.Refresh(); reportViewer1.Update(); So that it is refreshed after paramaters on the page are updated What do I need to enable this? Thanx, DiNo

What needs to be done to support local processing of reports.



  • You must to post comments

You can add any property or event to the wrapper and redirect it to the instance of the report viewer. The same way you’d do with ASP.NET.

The wrapper wraps the ReportViewer class, which is exposed through the typed WrappedControl property. That is the ReportViewer instance. You can set all of the properties directly to the WrappedControl instance. The problem is that ASP.NET controls don’t exist outside of the HTTP request, which is represented in ASP.NET by the page cycle: Init, Load, etc. You can affect the control only while processing Init or Load. There is a lot of documentation about the ASP.NET page cycle.

The Wisej AspNetWrapper class exposes the events PreInit, Init, and Load. You can either set the viewer property when handling those events, or you can extend the viewer wrapper class and add the properties and store the values in memory and then wait for OnInit, or OnLoad to update the viewer instance.





  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.