Hi,
We have a Silverlight application and we recently updated to use the latest Telerik UI and Reporting. However, we encountered some issues when passing parameter to the report. It seems that with the latest update of Telerik Reporting, the report cannot capture the parameters passed from ReportViewer. I was able to reproduce the issue in the Telerik Report Examples by changing the following:
1. In MainPage of CSharp.SilverlightDemo project, I've added the ApplyParameters event:
<telerik:ReportViewer Grid.Row="1" x:Name="ReportViewer1" Width="1000" ReportServiceUri="../ReportService.svc"
Report="Telerik.Reporting.Examples.CSharp.ReportCatalog, CSharp.ReportLibrary"
ApplyParameters="ReportViewer1_OnApplyParameters"/>
private void ReportViewer1_OnApplyParameters(object sender, ApplyParametersEventArgs args)
{
args.ParameterValues["Test1"] = "Test1";
args.ParameterValues["Test2"] = "Test2";
}
2. In ReportCatalog.cs of CSharp.ReportLibrary project, I've added the following:
public ReportCatalog()
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
ReportParameters.Add(new ReportParameter { Name = "Test1", Type = ReportParameterType.String });
ReportParameters.Add(new ReportParameter { Name = "Test2", Type = ReportParameterType.String });
ItemDataBinding += ReportCatalog_ItemDataBinding;
}
void ReportCatalog_ItemDataBinding(object sender, System.EventArgs e)
{
var test1 = ReportParameters["Test1"].Value;
var test2 = ReportParameters["Test2"].Value;
textBox4.Value = test1 != null ? test1.ToString() : "Test1 null";
textBox8.Value = test2 != null ? test2.ToString() : "Test2 null";
}
When I run the application, I was not getting the values of Test1 and Test2 parameters. This approach works in the previous version of Telerik Reporting.
Can you take a look why it is not working the latest version anymore and advise if there is another way to accomplish this?
Thanks,
Sherwin