首页 > 其他 > 详细

在Sharepoint 2010中使用ReportViewer控件展示RDLC报表

时间:2014-04-24 16:50:15      阅读:603      评论:0      收藏:0      [点我收藏+]

 微软的Visual studio提供了ReportViewer控件以及RDLC报表设计工具。下文主要介绍如何在Sharepoint 2010项目开发中使用ReportViewer和RDLC生成项目报表。由于Sharepoint 2010默认是禁用Session的,而RDLC报表必须启用Session。因此在Sharepoint的站点中要使用RDLC生成报表,可以对站点的web.config进行必要的设置后再自定义报表页面,然后通过对象模型获取获取数据表绑定到RDLC报表中。

        第一步,修改Sharepoint 2010站点的Web.confg支持ReportViewer控件。
        1.  在<system.web>节点中添加以下设置支持Sessioon state。

<sessionState mode="InProc" timeout="60" />
 

        2. 在<system.web>\<compilation>节点中添加ReportViewer支持

<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />

 

        3. 在<system.web>节点中修改<pages>节点属性enableSessionState值为true支持页面Session state。

<pages enableSessionState="true" enableViewState="true" ... >...

        4. 在<system.webServer>的<modules>节点中将<remove name="Session" />节点注释。

<!-- <remove name="Session" /> -->
 

        5. 在<system.webServer>的<handlers>添加ReportViewer控件支持。

<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

        6. 在<appSettings>里注释下面的行:
<add key="ReportViewerMessages" value="Microsoft.SharePoint.Portal.Analytics.UI.ReportViewerMessages, Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
     
第二步,在项目中创建一个DataSet和DataTable用于绑定到RDLC报表
          bubuko.com,布布扣

        第三步,在项目中创建一个名为Report1.rdlc的报表(假设发布到layouts\CooperTiers.TnE目录),并绑定到上步创建的数据源
          bubuko.com,布布扣


        第四步,创建一个用户控件或页面部件添加ReportViewer注册和控件,并通过代码加载Report1.rdlc报表
           HTML源码
        bubuko.com,布布扣

         C#源码
          bubuko.com,布布扣

        第五步,发布Sharepoint 项目,访问相应的用户控件或Web部件页面,页面预览如下图
          bubuko.com,布布扣

在Sharepoint 2010中使用ReportViewer控件展示RDLC报表,布布扣,bubuko.com

在Sharepoint 2010中使用ReportViewer控件展示RDLC报表

原文:http://www.cnblogs.com/flowxp/p/3683044.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!