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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Parameters for local processing

Thread ID:





140863 Nov 12,2018 08:29 AM UTC Nov 15,2018 07:38 AM UTC ASP.NET Core 2
Tags: ReportViewer
Vedran Vukasovic
Asked On November 12, 2018 08:29 AM UTC


I have a reportviewer that is processing report locally. 

<ej-report-viewer id="reportviewer1" enable-page-cache="false" report-path="obracun.rdl" report-service-url="http://localhost:5002/Report" processing-mode="Local" />

 public void OnReportLoaded(ReportViewerOptions reportOption)

     var parameters = reportOption.ReportModel.Parameters;

     var obracun = new Syncfusion.Report.ReportDataSource
                Name = "Obracun",
                Value = GetData(parameters )

And that is working fine.

But what I was unable to get is report parameters from report options: reportOption.ReportModel.Parameters, it is always null.

Use case is that I need to filter data before returning ReportDataSource. 

Is there any way to define parameters on front-end (ej-report-viewer). From ViewData/ViewBag somehow so that it would pass me a parameter to OnInitReportOptions/OnReportLoaded ?


Mahendran Shanmugam [Syncfusion]
Replied On November 13, 2018 10:20 AM UTC

Hi Vedran, 

Thanks for your interest in our Syncfusion products. 

We can to get the report parameter values using “ajaxBeforeLoad” event in reportloaded method at controller side. We have prepared a simple sample to load the RDLC report by passing the parameter from client to Report Controller as shown in below code example.  

<div style="height: 525px;width: 100%;"> 
    <ej-report-viewer id="reportviewer1" report-service-url="../Home" processing-mode="Local" rendering-begin="renderingBegin" ajax-before-load="ajaxBeforeLoad" /> 
<script type="text/javascript"> 
    function ajaxBeforeLoad(event) { 
        var parameters = [{ 
            name: 'CustomerID', 
            labels: ['29889'], 
            values: [29889], 
            nullable: false 
        event.data = parameters; 

public partial class HomeController : Controller, IReportController 
        private IMemoryCache _cache; 
        private IHostingEnvironment _hostingEnvironment; 
        public string DefaultParam = null; 
        public HomeController(IMemoryCache memoryCache, IHostingEnvironment hostingEnvironment) 
            _cache = memoryCache; 
            _hostingEnvironment = hostingEnvironment; 
        public object PostReportAction([FromBody] Dictionary<string, object> jsonResult) 
            if (jsonResult.ContainsKey("CustomData")) 
                DefaultParam = jsonResult["CustomData"].ToString(); 
            return ReportHelper.ProcessReport(jsonResult, this, this._cache); 
        public object GetResource(ReportResource resource) 
            return ReportHelper.GetResource(resource, this, _cache); 
        public object PostFormReportAction() 
            return ReportHelper.ProcessReport(null, this, this._cache); 
        public void OnInitReportOptions(ReportViewerOptions reportOption) 
            string basePath = _hostingEnvironment.WebRootPath; 
            FileStream inputStream = new FileStream(basePath + @"\ReportsTemplate\Region.rdlc", FileMode.Open, FileAccess.Read); 
            reportOption.ReportModel.Stream = inputStream; 
        public void OnReportLoaded(ReportViewerOptions reportOption) 
            var parameters = new List<ReportParameter>(); 
            if (DefaultParam != null) 
                parameters = JsonConvert.DeserializeObject<List<ReportParameter>>(DefaultParam); 
            if (parameters != null && parameters.Count > 0) 
                reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "StoreSales", Value = StoreSales.GetData(Convert.ToInt32(parameters[0].Values[0])) }); 

We have prepared a sample to get the report parameter from client side to controller side and it can be downloaded from below location. 

Mahendran S. 

Vedran Vukasovic
Replied On November 15, 2018 07:38 AM UTC


thx, this is working.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon