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
2. Select Web Forms Project
3. Run the application by pressing F5
4. Create a new Reports.aspx page with Master Page.
5. Open Nuget Package Manager Console from Tools > Nuget Package Manager
6. Install the ReportViewerControl for WebForms using Install-Package Microsoft.ReportingServices.ReportViewerControl.WebForms
7. Type the following in the Reports.aspx.cs page.
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=, 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>"/>
8. Run the application by pressing F5 and navigate to Reports.aspx page and you can see the Paginated Report served as shown below.
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.
Technorati Tags: ,

No comments:

Post a Comment