我有一个本地 .rdlc 报告被操纵以在单击按钮时显示,但由于某种原因,该报告仅显示在第二个按钮单击事件中。我不知道为什么报告没有在第一次单击按钮时显示...这是我在按钮的单击事件中调用的函数。
private void ShowReport(string accountingCompanyId, string companyId, string approvalUnitId, DateTime startDate, DateTime finishDate, string supplierId,
string documentNumber, string documentType, string documentState, string costCenterId, string chargingKeyId,
string dim1Value, string dim1Description, string dim1Id, string dim2Value, string dim2Description, string dim2Id,
string dim3Value, string dim3Description, string dim3Id, bool showDetails) {
//this.ReportViewer1.Reset();
//Set report mode for local processing.
this.ReportViewer1.ProcessingMode = ProcessingMode.Local;
ISettingsReader settingsReader = SettingsReaderFactory.Instance.CreateSettingsReader();
this.ReportViewer1.LocalReport.ReportPath = settingsReader.GetSetting("ReportViewer", "FinancialReportPath" + (showDetails ? "" : "Small"), true, null);
ReportsBL reports = new ReportsBL();
// Clear out any previous datasources.
this.ReportViewer1.LocalReport.DataSources.Clear();
// Load the company dataSource.
DataTable company = reports.GetCompanyDataSet(accountingCompanyId).Tables[0];
ReportDataSource dataSourceCompany = new ReportDataSource(company.TableName, company);
this.ReportViewer1.LocalReport.DataSources.Add(dataSourceCompany);
// Load the dataSource.
DataTable report = reports.GetReportFinanceiroSmallDataSet(companyId, startDate, finishDate, chargingKeyId, costCenterId, documentNumber, documentType, dim1Value, dim2Value, dim3Value, dim1Id, dim2Id, dim3Id, supplierId, approvalUnitId, documentState, accountingCompanyId).Tables[0];
ReportDataSource dataSourceReport = new ReportDataSource(report.TableName, report);
this.ReportViewer1.LocalReport.DataSources.Add(dataSourceReport);
this.ReportViewer1.LocalReport.Refresh();
this.pnlReport.Visible = true;
}
奇怪的是,如果我取消注释 this.ReportViewer.Reset(); 那么无论我产生多少点击次数,报告都不会显示...有人知道这是否正常吗?如何解决这个问题?提前致谢,