Search code examples
c#asp.netteleriktelerik-reporting

Invalid value of report parameter XXX in Telerik


I face the following problem when try to render my report :

Invalid value of report parameter XXX

I add the parameters programatically like this :

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>

Stack Details :

[Exception: Invalid value of report parameter 'camp_code'.] [CancelProcessingException: An error has occurred while processing the report. Processing canceled. Check the InnerException for more information.] 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.ProcessReport(ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext) +308 Telerik.ReportViewer.WebForms.ReportRenderOperation.PerformOperationOverride() +159 Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperationOverride() +83 Telerik.ReportViewer.WebForms.HandlerOperation.PerformOperation(HttpContext context, ICacheManager cacheManager) +45 Telerik.ReportViewer.WebForms.BasicHandler.ProcessRequest(HttpContext context) +160 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +76


Solution

  • Quoted from this link, your problem is:

    ... Namely, when a report enters in the processing stage, its value is validated against its validation properties. If one or more parameters do not have valid values, processing is aborted. Report Parameters define the following properties used to validate the supplied parameters' value:

    Type

    Determines the type of the values that are acceptable. The allowed types are Boolean, DateTime, Integer ,Float ,String. The default parameter type is String.

    AllowNull

    Determines if null (Nothing in VB.Net) is acceptable.

    AllowBlank

    Applied only when the parameter is of type String. Determines if an empty string is acceptable.