We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Change Report Path during Running

Hello Dears,

I just wonder if you help me regard my below query.

I have a report viewer rendered with specific rdlc report, I want to change the rdlc report and keep the same dataset and datascource during running and without get back to controller action, where my both reports are with the same dataset, is that possible.

BR

3 Replies

YD Yuvaraj Devarajan Syncfusion Team January 26, 2017 07:53 AM UTC

Hi Anas, 

Thanks for contacting Syncfusion support. 

We can dynamically change the Report RDLC file in viewer page by changing the report name in reportpath property and we can pass the datasource value in WebAPI controller as shown in below code example.  

   <script>       
        function onChange(args) { 
            var url = document.URL;                                  
              $("#container").ejReportViewer( 
              { 
                  reportServiceUrl: url + 'api/ReportApi', 
                  processingMode: ej.ReportViewer.ProcessingMode.Local, 
                  reportPath: '~/App_Data/' + args.selectedText                   
              });           
        } 
    </script> 

public void OnInitReportOptions(ReportViewerOptions reportOption) 
        { 
            reportOption.ReportModel.DataSources.Clear(); 
            reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "Sales", Value = SalesDetails.GetData() }); 
        } 

We have prepared a sample and it can be downloaded from, 

Regards, 
Yuvaraj D. 



AA Anas Alwindawee January 26, 2017 09:03 AM UTC

Hi Yuvara,

Thanks for your kind support, it's work perfectly.

BR


YD Yuvaraj Devarajan Syncfusion Team January 27, 2017 05:05 AM UTC

Hi Anas, 
 
Thanks for the update. We are happy to hear that your issue is resolved. 
 
Regards, 
Yuvaraj D 
 


Loader.
Live Chat Icon For mobile
Up arrow icon