Question

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

Was it helpful?

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.

OTHER TIPS

Answer 1: a parameter was missing (not the one mentioned in the error).

Answer 2: on another report, the problem was that there were two data sources, one of which was to offer a drop down list of choices for the main source's parameter. When the report is generated programmatically using reportProcessor.RenderReport method, the supplied parameter must appear in the list generated by the data source for the drop down list.

Answer 3: in the report designer, right click below the report and select Report Parameters. For each parameter, check it's type and restrictions.

Answer 4: For each data source in the report, check the type of each parameter, and check that the value is assigned in the value column.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top