Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3590
XamReportViewer dynamically loading report and changing parameters
posted

Perhaps I am not doing this correctly so please tell me if there is a better way to accomplish this as I am not ties to this method.

What I need is a way to allow a user to choose the report to run. Once the report is chosen I pull the igr file, parse out what parameters are needed and then generate a more user friendly selection control based on the data type (such as a datpicker for date field). The problem I run into is that I have the XamReportViewer bound to a ComboBox that lists all the reports so as the user selects the report the report viewer updates and I get an error that the new report does not contain a parameter called XXXXX. I tried clearing out the parameters in the combobox onchanged event but it must fire after the report viewer is updated.

<ig:XamReportViewer Name="xamReportViewer" PageFit="Width" Grid.Row="1">
   <ig:XamReportViewer.RenderSettings>
      <ig:ServerRenderSettings ServiceEndpointUri="/ReportService1.svc/soapAddress/" DefinitionUri="{Binding ElementName=reportlist,Path=SelectedItem.Value}" />
   </ig:XamReportViewer.RenderSettings>
</ig:XamReportViewer>

Is there a sample on how to dynamically load reports and parameters? Is this the proper approach and if so how do I reset the parameters once a new report is selected or do I have to manually update the DefinitionUri in the onChanged event as well?