开发者

ASP.NET 4.0 - Hosting a ReportViewer control inside a Web Part control

I have a series of reports designed in Reporting Services that I'd like to make available through a single ASP.NET web page. I plan to make the reports available via the ReportViewer control. Unfortunately we don't have SharePoint available and my company isn't looking to buy it - so I'm stuck (I believe) with this method.

Is it possible to host a ReportViewer control inside a Web Part control? First off the ReportViewer control displays my reports perfectly on the page. But once I wrap them in the WebPartZone control I get the following error:

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.

Here is an example web part / report declaration:

<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>

The reason I'm using Web Parts is to make a dashboard style page.

What can I do to make the datasource available? Or perhaps there is a better / easier way to generate a dashboard style layout in ASP.NET for reporting services reports.

Any pointers appreciated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜