In this article we will discuss installing the MVCReportViewer package into your MVC application to get it ready to embed reports.
In Part 2 , we will discusss embedding local reports into your MVC application and in Part 3 we will discuss the changes needed to embed reports from yourn SSRS server.
Embedding SSRS or indeed local RDLC reports into a view in an ASP.NET MVC application is easy using the MVCReportViewer package , and the HTML Helpers it comes with.
The first step to get the MVCReportViewer package installed into your project , to do this you can use the Package manager console in Visual Studio , using the following command:
This will add the relevant scripts, Web.Config app settings and report viewer appx to your MVC Application which are needed to embed your reports into your views.
After sucessfully installing the MVCReportViewer package you will notice some changes to your application.
The following App settings for the report viewer have been added to your Web.Config:
<add key="MvcReportViewer.AspxViewer" value="/MvcReportViewer.aspx" />
<add key="MvcReportViewer.AspxViewerJavaScript" value="~/Scripts/MvcReportViewer.js" />
<add key="MvcReportViewer.ErrorPage" value="~/MvcReportViewerErrorPage.html" />
<add key="MvcReportViewer.ShowErrorPage" value="true" />
<add key="MvcReportViewer.ReportServerUrl" value="http://localhost/Reportserver_SQLEXPRESS" />
<add key="MvcReportViewer.Username" value="" />
<add key="MvcReportViewer.Password" value="" />
<add key="MvcReportViewer.EncryptParameters" value="false" />
<add key="MvcReportViewer.IsAzureSSRS" value="false" />
<add key="MvcReportViewer.LocalDataSourceProvider" value="MvcReportViewer.SessionLocalDataSourceProvider, MvcReportViewer" />
Key settings to note here , are the AspxViewer setting, which points to the aspx page which has also been installed by the NuGet package . It is this page that will be used to display our report in an iframe.
The ReportServerUrl and LocalDataSourceProvider settings are important depending on wehther you want to embed a server report or a local one. I will use both later on when i give examples of both scenarios.
And that's it, now you are ready to embed a server or local report into your MVC views. See the following articles for examples of both.
In Part 2 , we will discusss embedding local reports into your MVC application and in Part 3 we will discuss the changes needed to embed reports from yourn SSRS server.
Embedding SSRS or indeed local RDLC reports into a view in an ASP.NET MVC application is easy using the MVCReportViewer package , and the HTML Helpers it comes with.
The first step to get the MVCReportViewer package installed into your project , to do this you can use the Package manager console in Visual Studio , using the following command:
PM> Install-Package MvcReportViewer
After sucessfully installing the MVCReportViewer package you will notice some changes to your application.
The following App settings for the report viewer have been added to your Web.Config:
<add key="MvcReportViewer.AspxViewer" value="/MvcReportViewer.aspx" />
<add key="MvcReportViewer.AspxViewerJavaScript" value="~/Scripts/MvcReportViewer.js" />
<add key="MvcReportViewer.ErrorPage" value="~/MvcReportViewerErrorPage.html" />
<add key="MvcReportViewer.ShowErrorPage" value="true" />
<add key="MvcReportViewer.ReportServerUrl" value="http://localhost/Reportserver_SQLEXPRESS" />
<add key="MvcReportViewer.Username" value="" />
<add key="MvcReportViewer.Password" value="" />
<add key="MvcReportViewer.EncryptParameters" value="false" />
<add key="MvcReportViewer.IsAzureSSRS" value="false" />
<add key="MvcReportViewer.LocalDataSourceProvider" value="MvcReportViewer.SessionLocalDataSourceProvider, MvcReportViewer" />
Key settings to note here , are the AspxViewer setting, which points to the aspx page which has also been installed by the NuGet package . It is this page that will be used to display our report in an iframe.
The ReportServerUrl and LocalDataSourceProvider settings are important depending on wehther you want to embed a server report or a local one. I will use both later on when i give examples of both scenarios.
And that's it, now you are ready to embed a server or local report into your MVC views. See the following articles for examples of both.
No comments:
Post a Comment