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

Bind Local Report

Hello,
to embedded report view and work ok, but how I can add a local report?

1 Reply

MM Mageshyadav M Syncfusion Team November 19, 2018 05:47 AM UTC

Hi Mohamed, 
 
Thanks for contacting Syncfusion support, 
 
We can render the RDLC report in ReportViewer using PHP and Service API samples. We can pass the reportServiceUrl, reportPath and processingMode as shown in below code example in php page. 
 
Index.php: 
<?php 
$reportviewer = new EJ\ReportViewer('territorysales_reportViewer');                  
        echo $reportviewer->reportServiceUrl("http://localhost:62610/api/ReportApi" )->processingMode("Local")->reportPath("~/App_Data/Region.rdlc")->render(); 
?> 
 
We can pass the Datasource in both Design side and controller side. We have passed the Datasource  as Object model in Controller side as shown in below code example. 
 
ReportApiController.cs 
public class ReportApiController : ApiController,IReportController  
    { 
        //Post action for processing the rdl/rdlc report  
        public object PostReportAction(Dictionary < string, object > jsonResult)  
        {            
            return ReportHelper.ProcessReport(jsonResult, this); 
        } 
         
        //Get action for getting resources from the report 
        [System.Web.Http.ActionName("GetResource")] 
        [AcceptVerbs("GET")] 
        public object GetResource(string key, string resourcetype, bool isPrint)  
        { 
            return ReportHelper.GetResource(key, resourcetype, isPrint); 
        } 
         
        //Method will be called when initialize the report options before start processing the report         
        public void OnInitReportOptions(ReportViewerOptions reportOption) 
        { 
 
        } 
 
        //Method will be called when reported is loaded 
        public void OnReportLoaded(ReportViewerOptions reportOption)  
        { 
           reportOption.ReportModel.DataSources.Clear(); 
            reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "StoreSales", Value = StoreSales.GetData() }); 
        } 
 
Please refer the below help documentation for how to load the RDLC report in ReportViewer using PHP platform. 
 
We have prepared the sample for your reference and it can be downloaded from below location. 
 
Note: Please run the Service API before running the PHP sample. 
 
Output snap: 
 
 
Regards, 
Mageshyadav.M 


Loader.
Live Chat Icon For mobile
Up arrow icon