ASP.NET 4.0 - 在Web部件控件中托管ReportViewer控件

时间:2010-08-12 08:11:48

标签: web-parts reportviewer asp.net-4.0

我在Reporting Services中设计了一系列报告,我希望通过单个ASP.NET网页提供这些报告。我计划通过ReportViewer控件提供报告。不幸的是,我们没有SharePoint可用,我的公司也不打算购买它 - 所以我坚持(我相信)这种方法。

是否可以在Web部件控件中托管ReportViewer控件?首先,ReportViewer控件在页面上完美显示我的报告。但是一旦我将它们包装在WebPartZone控件中,我就会收到以下错误:

The DataSourceID of the ReportDataSource 'DataSet1' of the ReportViewer 'ReportViewer1' must be the ID of a control of type IDataSource. A control with ID 'ObjectDataSource1' could not be found.

以下是一个示例Web部件/报告声明:

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
                    Font-Size="8pt" InteractiveDeviceInfos="(Collection)" 
                    WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
                    <LocalReport ReportPath="Report2.rdlc">
                        <DataSources>
                            <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
                        </DataSources>
                    </LocalReport>
                </rsweb:ReportViewer>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                    SelectMethod="GetProducts" TypeName="Merchant"></asp:ObjectDataSource>

我使用Web部件的原因是制作仪表板样式页面。

如何使数据源可用? 或者,可能有更好/更简单的方法在ASP.NET中生成用于报告服务报告的仪表板样式布局。

任何指示赞赏。

0 个答案:

没有答案