ActiveReports - 获取数据的次数过多

时间:2015-07-28 15:25:59

标签: c# activereports

我有一份主要报告和一份子报告。

//主报告调用subReport

DataView dvDetails = new DataView(_dtDetails); // _dtDetails is a datatable
rptSubHistory rptSubHistory = new rptSubHistory(dvDetails);
rptSubHistory.DataSource = dvDetails;
subHistory.Report = rptSubHistory;

//从子报告中获取数据

public void rptSubHistory_FetchData(object sender, GrapeCity.ActiveReports.SectionReport.FetchEventArgs eArgs)
  {
       _intRecordCount++;
  }

//来自子报告的详细格式

 public void Detail_Format(object sender, System.EventArgs eArgs)
  {
      if (_dvDetails.Count > 0)
      {
          txtColumn.Text = _dvDetails.Table.Rows[_intRecordCount]["ColumnName"].ToString();
          txtOrigValue.Text = _dvDetails.Table.Rows[_intRecordCount]["OrigValue"].ToString();
          txtNewValue.Text = _dvDetails.Table.Rows[_intRecordCount]["CurrentValue"].ToString();
      }
  }

我遇到的问题是,当主报表调用子报表时,从子报表中获取数据会自行迭代数据源的确切计数。希望有道理。因此,例如,dvDetails的计数为32.当从子报告中获取数据时,它会自行迭代32次,从不接触Detail_Format。是什么导致了这种行为。上周这完美无缺。它将点击FetchData然后详细格式以生成一个行项目,冲洗重复。

从设计端事件属性我有“FetchData”指向上面列出的获取数据。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:1)

I solved the issue that I was having. Apparently just assigning the dataview as the datasource of the sub report was enough. In the datafiled property of the sub report I assigned the column names of the DV as the values. And removed the fetchdata and detailFormat functions from the sub report all together. Since I already had the values I needed in the DV, it just automatically populates.

相关问题