使用Microsoft.Reporting. WebForms中ReportViewer报表查看器(Server方式)
时间: 2023-11-28 08:48:21 浏览: 94
要使用Microsoft.Reporting.WebForms中的ReportViewer报表查看器(Server方式),需要按照以下步骤进行操作:
1. 在Visual Studio中创建一个ASP.NET Web应用程序。
2. 在Web应用程序中,添加对Microsoft.Reporting.WebForms的引用。
3. 在Web.config文件中,添加以下配置节:
```
<system.web>
<httpHandlers>
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.Reporting.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="Reserved-ReportViewerWebControl" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.Reporting.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" preCondition="integratedMode"/>
</handlers>
</system.webServer>
```
4. 在Web应用程序中,添加一个ReportViewer控件。
5. 在代码中,设置ReportViewer控件的ServerReport属性,指定要查看的报表的URL。例如:
```
reportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/reportserver");
reportViewer1.ServerReport.ReportPath = "/MyReports/MyReport";
```
6. 运行Web应用程序,即可查看报表。
阅读全文
相关推荐
















