通过动态为ReportPath赋值无效,报表格式仍是原来的,但表中的数据已经更改,我希望报表格式和数据同时改变,请指教,谢谢
ASP:
<rsweb:ReportViewer ID="ReportViewer" runat="server" 
    Width="963px" Font-Names="Verdana" Font-Size="8pt" Height="395px" 
    Visible="False" Enabled="False">
    <LocalReport >
        <DataSources>
            <rsweb:ReportDataSource DataSourceId="ODS_Report" Name="JSMonDataSet_VDBasicSingleTable" />
            <rsweb:ReportDataSource DataSourceId="ODS_Report" Name="JSMonDataSet_VDBasicAllTable" />
        </DataSources>
    </LocalReport>
</rsweb:ReportViewer> <asp:ObjectDataSource ID="ODS_Report" runat="server" 
        SelectMethod="GetDayData" 
        OldValuesParameterFormatString="original_{0}" >
 </asp:ObjectDataSource>C#
this.ReportViewer.LocalReport.ReportPath = "RDLC/VDBasicSingle.rdlc";
this.ODS_Report.TypeName = "JSMonDataSetTableAdapters.VDBasicSingleTableTableAdapter";

解决方案 »

  1.   

    简化后:
    <rsweb:ReportViewer ID="ReportViewer" runat="server" 
        Width="963px" Font-Names="Verdana" Font-Size="8pt" Height="395px" 
        Visible="False" Enabled="False"> 
        <LocalReport > 
            <DataSources> 
            </DataSources> 
        </LocalReport> 
    </rsweb:ReportViewer> C# 
    this.ReportViewer.LocalReport.ReportPath = "RDLC/VDBasicSingle.rdlc"; 然后绑定数据源
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.LocalReport.DataSources.Add(rds);
    ReportViewer1.LocalReport.Refresh();