Hello. We are using a Silverlight ReportViewer to call into a class library that contains a report definition. 90% of the time our report comes up fine. But the other 10% of the time, we get the message:
"One or more parameters are not set or have invalid values"
in the report that pops up.
I am calling the report the same way every time, so that leads me to believe there is some kind of timing issue. [EDIT: When this happens, I see the report briefly flash on the screen. Then I get the message about the invalid values. At that point, if I click the refresh button the report viewer, the report comes up fine. It comes up very fast. So, it's not like it's rendering the report when I click the refresh button.]
I was hoping Telerik could see something that we are doing wrong that may be causing this timing issue. Again, we are calling the report with the same parameters, so it's not like we're leaving out a parameter.
In our XAML, we have a ReportViewer control. In the RenderBegin event of the ReportViewer, we are doing this (leaving out a lot of parameters for clarity - also taking out names that identity our business model):
In the NeedDataSource event of the report, we are doing this. (ReportItem is a class I defined.)
Not sure if this matters or not, but we are displaying the ReportViewer in a ChildWindow. In the code-behind of the XAML of the child window, we are doing this:
Thanks.
"One or more parameters are not set or have invalid values"
in the report that pops up.
I am calling the report the same way every time, so that leads me to believe there is some kind of timing issue. [EDIT: When this happens, I see the report briefly flash on the screen. Then I get the message about the invalid values. At that point, if I click the refresh button the report viewer, the report comes up fine. It comes up very fast. So, it's not like it's rendering the report when I click the refresh button.]
I was hoping Telerik could see something that we are doing wrong that may be causing this timing issue. Again, we are calling the report with the same parameters, so it's not like we're leaving out a parameter.
In our XAML, we have a ReportViewer control. In the RenderBegin event of the ReportViewer, we are doing this (leaving out a lot of parameters for clarity - also taking out names that identity our business model):
object
[] param1 =
new
object
[MyCollection.Count];
object
[] param2 =
new
object
[MyCollection.Count];
int
loopCounter = 0;
foreach
(Widget myWidget
in
MyCollection)
{
param1[loopCounter] = myWidget.param1;
param2[loopCounter] = myWidget.param2;
loopCounter++;
}
args.ParameterValues[
"Param1"
] = param1;
args.ParameterValues[
"Param2"
] = param2;
In the NeedDataSource event of the report, we are doing this. (ReportItem is a class I defined.)
Telerik.Reporting.Processing.Report myReport = (Telerik.Reporting.Processing.Report)sender;
System.Collections.Generic.List<ReportItem> reportItems =
new
System.Collections.Generic.List<ReportItem>();
object
[] param1Array = (
object
[])myReport.Parameters[
"Param1"
].Value;
object
[] param2Array = (
object
[])myReport.Parameters[
"Param2"
].Value;
for
(
int
loopCounter = 0; loopCounter < param1Array.Length; loopCounter++)
{
ReportItem ri =
new
ReportItem();
ri.param1 = param1Array[loopCounter].ToString();
ri.param2 = param2Array[loopCounter].ToString();
}
this
.DataSource = reportItems;
Not sure if this matters or not, but we are displaying the ReportViewer in a ChildWindow. In the code-behind of the XAML of the child window, we are doing this:
public
ShowMyReport()
{
InitializeComponent();
}
private
void
ChildWindow_Loaded(
object
sender, RoutedEventArgs e)
{
MyViewModel vm = (MyViewModel)
this
.DataContext;
vm.RefreshReport +=
new
System.Action(vm_RefreshReport);
ReportViewer1.RenderBegin += vm.OnBlahRenderBeginCommand;
// This points to the RenderBegin event I talked about above
vm.UpdateReport();
}
void
vm_RefreshReport()
{
((ReportViewerModel)
this
.ReportViewer1.DataContext).RefreshReportCommand.Execute(
null
);
}
Thanks.