【发布时间】:2021-10-01 17:28:39
【问题描述】:
BoldReports ReportViewer 控制器:
我在 OnReportLoaded() 方法中使用 ReportHelper.GetParametersWithValues() 函数来检索报表参数。它正在成功检索参数列表,但是,仅填充了名称属性 - 值为 null。
private ReportParameterInfoCollection _rptParamColl;
public void OnReportLoaded(ReportViewerOptions reportOption)
{
_rptParamColl = ReportHelper.GetParametersWithValues(jsonArray, this, _cache);
if (_rptParamColl != null)
{
foreach (ReportParameterInfo rptParam in _rptParamColl)
{
if (rptParam.Name == "OrgID")
{
if (rptParam.Values != null )
{
// perform appropriate validation on rptParam.Values[0]
}
}
}
}
}
在上面的代码示例中,rptParam.Name 有一个值,但 rptParam.Values 为空。我知道这些值存在,因为当我检查 jsonArray 对象时,它们就在那里(尽管奇怪的是,在调用 ReportHelper.GetParametersWithValues() 之后,jsonArray 对象被清除了?调用 ReportHelper.GetDataSources() 时也会发生同样的情况。这也是一个问题,因为我想调用这两种方法,并且在调用一个之后,不能调用另一个......)
任何想法我可能做错了什么?
【问题讨论】: