尝试呈现报告时遇到以下问题:
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 参数, Boolean processItemActions, Boolean documentMapEnabled) + 97 Telerik.Reporting.Processing.ReportProcessor.ProcessReport(ReportSource reportSource,IRenderingContext processingContext)+514 Telerik。