[英]Invalid value of report parameter XXX in Telerik
尝试呈现我的报告时,我面临以下问题:
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 dataContext) +112 Telerik.Reporting.Processing.Report.Process(DataItemState state, IEnumerable`1 parameters, Boolean processItemActions, Boolean documentMapEnabled) + 97 Telerik.Reporting.Processing.ReportProcessor.ProcessReport(ReportSource reportSource, IRenderingContext processingContext) +514 Telerik.Reporting.Processing.ReportProcessor.ProcessReport(ReportSource reportSource, Hashtable deviceInfo, IRenderingContext processingContext) +259 Telerik.ReportViewer.WebForms.ReportRenderOperation( ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext) +308 Telerik.ReportViewer.WebForms.ReportRenderOpe ration.PerformOperationOverride() +159 Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperationOverride() +83 Telerik.ReportViewer.WebForms.HandlerOperation.PerformOperation(HttpContext context, ICacheManager cacheManager) +45 Telerik.ReportViewer.WebForms.BasicHandler context.ProcessRequest() ) +160 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&completedSynchronously) +76
引自此链接,您的问题是:
... 即,当报告进入处理阶段时,根据其验证属性验证其值。 如果一个或多个参数没有有效值,则中止处理。 报告参数定义了以下用于验证所提供参数值的属性:
类型
确定可接受的值的类型。 允许的类型是 Boolean、DateTime、Integer、Float、String。 默认参数类型为字符串。
允许空值
确定 null(在 VB.Net 中没有)是否可以接受。
允许空白
仅当参数为字符串类型时应用。 确定空字符串是否可接受。
答案 1:缺少一个参数(不是错误中提到的那个)。
答案 2:在另一份报告中,问题是有两个数据源,其中一个是提供主要来源参数的下拉列表。 当使用 reportProcessor.RenderReport 方法以编程方式生成报告时,提供的参数必须出现在数据源为下拉列表生成的列表中。
答案3:在报表设计器中,右键单击报表下方并选择报表参数。 对于每个参数,检查它的类型和限制。
答案4:对于报表中的每个数据源,检查每个参数的类型,并检查值列中是否分配了值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.