I'm using Q1 2012 for an MVC 3 Application where a report is generated, attached to an email and sent. The parameters are applied from an object model containing all report parameters and strings representing each value. When applying the value in plain text, the report runs and attaches to the email as it should
EX.
Report.ReportParameter.Value[0] = "Value"
But when doing the same from the model, I receive an inner exception for an invalid parameter
Working Code:
rpt.ReportParameters[4].Value = Reporting.GetParametersObject("VAL1; VAL2");
But when the code is changed to this:
rpt.ReportParameters[4].Value = Reporting.GetParametersObject(email.EmailReportParameters.ToString());
I receive and inner exception error and the parameter value returns to null.
The GetParametersObject converts a string to an Object[].
The debugger shows the same values in both cases as type {string[]}
Model: (I've also tried an Object[] for EmailReportParameters with the same result)
Single value parameters are working properly:
rpt.ReportParameters[0].Value = email.EmailReportParameters[0];
Error Detail:
EX.
Report.ReportParameter.Value[0] = "Value"
But when doing the same from the model, I receive an inner exception for an invalid parameter
Working Code:
rpt.ReportParameters[4].Value = Reporting.GetParametersObject("VAL1; VAL2");
But when the code is changed to this:
rpt.ReportParameters[4].Value = Reporting.GetParametersObject(email.EmailReportParameters.ToString());
I receive and inner exception error and the parameter value returns to null.
The GetParametersObject converts a string to an Object[].
The debugger shows the same values in both cases as type {string[]}
Model: (I've also tried an Object[] for EmailReportParameters with the same result)
public class EmailReport
{
public string EmailAddress { get; set; }
public string EmailAttachmentExtension { get; set; }
public string EmailAttachName { get; set; }
public string EmailSubject { get; set; }
public string EmailBody { get; set; }
public String[] EmailReportParameters { get; set; }
}
Single value parameters are working properly:
rpt.ReportParameters[0].Value = email.EmailReportParameters[0];
Error Detail:
InnerException {"Invalid value of report parameter 'LineOfBusiness1'."}
at Telerik.Reporting.Processing.Report.ResolveData()
at Telerik.Reporting.Processing.Report.ProcessItem()
at Telerik.Reporting.Processing.ReportItemBase.Process(DataMember data)
at Telerik.Reporting.Processing.Report.Process(DataMember data, DataItemState state, Boolean processItemActions, Boolean documentMapEnabled)
at Telerik.Reporting.Processing.ReportProcessor.ProcessReport(IReportDocument reportDocument, IDictionary processingContext)
at Telerik.Reporting.Processing.ReportProcessor.ProcessReport(IReportDocument reportDocument, Hashtable deviceInfo, Hashtable renderingContext)
at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRender(String format, IReportDocument reportDocument, Hashtable deviceInfo, Hashtable renderingContext, CreateStream createStreamCallback)
at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRenderStateless(String format, IReportDocument reportDocument, Hashtable deviceInfo, Hashtable renderingContext, CreateStream createStreamCallback)
at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo)
at compucom.TrackIT.Reports.Controllers.EmailReportController.SendEmailReport(EmailReport email) in C:\Users\tk83673\Documents\Projects\ITOProdSolutions\TrackIT\USBank\compucom.TrackIT.Reports\Controllers\EmailReportController.cs:line 76
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<
InvokeActionMethodWithFilters
>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)