Sunday, December 31, 2017

SSRS 2017 and ReportViewer control in ASP.NET Web Application (.NET Framework)

1. Create a new ASP.NET Web Application (.NET Framework) Project using Visual Studio 2017
ReportViewer1
2. Select Web Forms Project
ReportViewer2
3. Run the application by pressing F5
ReportViewer2a
4. Create a new Reports.aspx page with Master Page.
ReportViewer3
5. Open Nuget Package Manager Console from Tools > Nuget Package Manager
ReportViewer4
6. Install the ReportViewerControl for WebForms using Install-Package Microsoft.ReportingServices.ReportViewerControl.WebForms
ReportViewer5
ReportViewer6
7. Type the following in the Reports.aspx.cs page.
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
         <rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote" Width="850px" Height="680px">
             <ServerReport ReportServerUrl="http://<your report server>/ReportServer"  ReportPath="/<folder name>/<rdl report name>"/>
         </rsweb:ReportViewer>
</asp:Content>
8. Run the application by pressing F5 and navigate to Reports.aspx page and you can see the Paginated Report served as shown below.
ReportViewer7
Is it possible to embed my Mobile Reports in Web Pages using my Report Viewer Control?
No, that is not possible. You can embed only Paginated Reports and if you try to embed Mobile Reports you will get “The operation you are attempting on item ‘<Report name>’ is not allowed for this item type. (rsWrongItemType)“ as shown below.
ReportViewer8
Technorati Tags: ,

No comments:

Post a Comment