【问题标题】:Invalid value of report parameter XXX in TelerikTelerik 中报告参数 XXX 的值无效
【发布时间】:2013-06-18 12:14:59
【问题描述】:

我在尝试呈现报告时遇到以下问题:

Invalid value of report parameter XXX

我像这样以编程方式添加参数:

protected void btn_generate_Click(object sender, EventArgs e)
        {

            AddParamToRep();
            rep_attend.Visible = true;
        }

  protected void AddParamToRep()
        {
            try
            {
                int campCode = 0;
                if (ddl_camps != null && ddl_camps.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(ddl_camps.SelectedValue))
                    {
                        campCode = int.Parse(ddl_camps.SelectedValue);
                    }
                }

                rep_attend.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("camp_code", campCode));
                rep_attend.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("dep_code", int.Parse(rad_ddl_dep.SelectedValue)));
                rep_attend.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("dep_name", rad_ddl_dep.SelectedItem.Text));
                rep_attend.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("rep_type", int.Parse(rbl_type.SelectedValue)));
            }
            catch (Exception ee)
            {
            }

        }

<telerik:ReportViewer ID="rep_attend" runat="server" Width="100%" Height="700px"
        Visible="false" ParametersAreaVisible="False" ShowPrintButton="False"> <typereportsource 
        typename="Reports.Det_HR_rep,Reports, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"></typereportsource>
</telerik:ReportViewer>

堆栈详情:

[异常:报告参数“camp_code”的值无效。] [CancelProcessingException:处理时发生错误 报告。处理已取消。检查 InnerException 了解更多信息 信息。] Telerik.Reporting.Processing.Report.ValidateParameters() +218 Telerik.Reporting.Processing.Report.ProcessItem() +51 Telerik.Reporting.Processing.ReportItemBase.ProcessElement() +31 Telerik.Reporting.Processing.Report.ProcessElement() +21 Telerik.Reporting.Processing.ProcessingElement.Process(DataMember 数据上下文)+112 Telerik.Reporting.Processing.Report.Process(DataItemState 状态, IEnumerable`1 参数,布尔型 processItemActions,布尔型 文档地图启用)+97 Telerik.Reporting.Processing.ReportProcessor.ProcessReport(ReportSource reportSource,IRenderingContext processingContext)+514 Telerik.Reporting.Processing.ReportProcessor.ProcessReport(ReportSource reportSource、哈希表 deviceInfo、IRenderingContext 处理上下文)+259 Telerik.ReportViewer.WebForms.ReportRenderOperation.ProcessReport(ReportSource reportSource、哈希表 deviceInfo、IRenderingContext 渲染上下文)+308 Telerik.ReportViewer.WebForms.ReportRenderOperation.PerformOperationOverride() +159 Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperationOverride() +83 Telerik.ReportViewer.WebForms.HandlerOperation.PerformOperation(HttpContext 上下文,ICacheManager 缓存管理器)+45 Telerik.ReportViewer.WebForms.BasicHandler.ProcessRequest(HttpContext 上下文)+160 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +76

【问题讨论】:

  • 错误字面意思是XXX 还是参数的名称?我的意思是这个名字对于调试非常有用
  • @MichaelPerrenoud :camp_code,参数名称

标签: c# asp.net telerik telerik-reporting


【解决方案1】:

引用自this link,你的问题是:

... 即,当报告进入处理阶段时,其值将根据其验证属性进行验证。如果一个或多个参数没有有效值,则中止处理。报告参数定义了用于验证提供的参数值的以下属性:

类型

确定可接受的值的类型。允许的类型为 Boolean、DateTime、Integer、Float、String。默认参数类型为字符串。

AllowNull

确定是否可以接受 null(VB.Net 中的任何内容)。

允许空白

仅在参数为字符串类型时应用。确定是否可以接受空字符串。

【讨论】:

  • int.Parse("...")Int32 不同吗?
  • @just_name,不,intInt32 的别名。
  • 我允许所有字段为null,所以异常消失但报告为空?!!
  • 虽然我调试了代码,发现每个参数都有一个值
  • @just_name,现在将专门针对报告。
【解决方案2】:

答案 1:缺少一个参数(不是错误中提到的那个)。

答案 2: 在另一份报告中,问题在于有两个数据源,其中一个是提供主源参数的下拉列表选项。当使用 reportProcessor.RenderReport 方法以编程方式生成报表时,提供的参数必须出现在下拉列表的数据源生成的列表中。

答案 3: 在报表设计器中,右键单击报表下方并选择报表参数。对于每个参数,检查它的类型和限制。

答案4:对于报表中的每个数据源,检查每个参数的类型,并检查值列是否赋值。

【讨论】:

    猜你喜欢
    • 2021-03-24
    • 2015-06-04
    • 1970-01-01
    • 2020-12-01
    • 1970-01-01
    • 2013-11-15
    • 2013-06-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多