0
  protected void ReportViewer1_Back(object sender, BackEventArgs e)
    {       
        GetReportData();
    }

该操作只能从钻取报告执行, 当我使用报告查看器后退按钮事件重新加载父报告时会抛出此错误。

这是GetReportData()方法

protected void GetReportData()
    {
        try
        {
            DataSet dsreport = bd.bStatePerfomanceReport(Convert.ToInt32(ddlYear.SelectedValue), reportdetail.month, Convert.ToInt32(rdbCol.SelectedValue));
            ReportViewer1.Visible = true;
            ReportDataSource rds = new ReportDataSource();
            ReportViewer1.Reset();
            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            LocalReport rep = ReportViewer1.LocalReport;
            rep.Refresh();
            rep.ReportPath = "rdlc/StateataGlance.rdlc";
            rds.Name = "dsReport_uspReport_StateataGlance";
            rds.Value = dsreport.Tables[0];
            rep.DataSources.Add(rds);

            ReportParameter[] parms = new ReportParameter[3];
            parms[0] = new ReportParameter("month", ddlMonth.SelectedItem.Text + ",  " + ddlYear.SelectedItem.Text, true);
            parms[1] = new ReportParameter("mo", ddlMonth.SelectedValue, true);
            parms[2] = new ReportParameter("year", ddlYear.SelectedValue, true);
            this.ReportViewer1.LocalReport.SetParameters(parms);
            rep.Refresh();
            ViewState["level"] = 0;
        }
        catch
        {
        }
    }

及其在页面加载事件上的工作,但是当我在后退按钮事件上调用相同的方法时,它会抛出错误。

4

0 回答 0