I have created multiple reports, and I want to display them on a single ReportViewer. All is fine when the reports are based on the same database table, because the ObjectDataSource points to the proper data source definition. However when the report is based on an alternate table in DataSet, the report is not rendered properly.
Here is the code generated for my ReportViewer
I have used a dropdownlist to allow me to pick the desired report. I change the LocalReport.ReportEmbeddedResource and the LocalReport.ReportPath to point to Report2 (this all works). I have created ObjectDataSource2 which links to the underlying table used for Report2. I need to change the ReportDataSource DataSourceID to "ObjectDataSource2" so it links to the alternate table in my Dataset.Code:<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"> <LocalReport ReportEmbeddedResource="WebWithAccess.Report1.rdlc" ReportPath="Report1.rdlc"> <DataSources> <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" /> </DataSources> </LocalReport> </rsweb:ReportViewer>
How can I make this change in code?




Reply With Quote
