Starting in 2019, the Reporting control is no longer included in Essential Studio®. If you're experiencing issues with the Syncfusion� Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion� and appreciate your understanding.

Unable to display report parameter pane

Hi,

I'm using the reportview control to load a local rdl/rdlc report with parameters defined.  However, when the report is loaded, the parameter pane section does not display and hence I cannot input the parameter values at runtime.  The report content does generated but all parameter fields are blank in the report output.

The sample reports from the SDK demo is able to show the parameter.  Is there any setting I'm missing?

Using Asp.net Core EJ1 @ v.16.3.0.21

Thank you for your attention!

Kenneth

Attachment: ReportViewer_a4d0dd24.zip

5 Replies

MM Mageshyadav M Syncfusion Team October 30, 2018 09:05 AM UTC

Hi Kenneth, 
 
Thanks for contacting Syncfusion support. 
 
We have checked the mentioned problem with shared details. We suspect the mentioned problem occurs when we set the parameter visibility is hidden while designing as shown in below snap. 
 
 
 
We have prepared the sample for your reference and it can be downloaded from below location. Can you please confirm whether the attached sample is working or not at your end. 
 
If issue still persists then can you please share your rdl report which will be helpful for us to determine the actual reason for issue. 
 
Regards, 
Mageshyadav.M 



KL Kenneth Lo November 5, 2018 04:19 AM UTC

Hi Mageshyadav,

Thank you for your reply.  After looking at your sample, I can get the parameter display in the report viewer.  However, I have some parameter in my reports that are in text and datetime types.  When I don't provide a default value and available values, the parameters displayed as dropdown.  Is there any reason that the parameters failed to display as  a date picker for datetime type and a textbox for text type?

I have added a text type parameter to the sample report you have sent me.  The added parameter can show up as textbox in the preview in the report designer.  However, it becomes a dropdown when I run it in the sample.

A second question,  is there a way to pass parameter value to the report by code in Asp.Net Core?

Regards,

Kenneth Lo

Attachment: Report_Parameter_ee089a44.zip


MM Mageshyadav M Syncfusion Team November 6, 2018 04:41 AM UTC

Hi Kenneth, 
 
Please find the response for your queries. 
 
Query 
Response 
Thank you for your reply.  After looking at your sample, I can get the parameter display in the report viewer.  However, I have some parameter in my reports that are in text and datetime types.  When I don't provide a default value and available values, the parameters displayed as dropdown.  Is there any reason that the parameters failed to display as  a date picker for datetime type and a textbox for text type? 
 
I have added a text type parameter to the sample report you have sent me.  The added parameter can show up as textbox in the preview in the report designer.  However, it becomes a dropdown when I run it in the sample. 
 
We are able to reproduce the reported issue. This issue has been already fixed in our 2018 Volume 3 SP1 release version 16.3.0.29 and please upgrade to this version to resolve this issue. 
 
Please find the download link of 2018 Volume 3 SP1 release version, 
 
https://www.syncfusion.com/forums/140650/essential-studio-2018-volume-3-service-pack-release-v16-3-0-29-available-for-download 
A second question,  is there a way to pass parameter value to the report by code in Asp.Net Core? 
We can achieve your requirement using setModel option to set parameters property of Report Viewer control if you are using RDL report with processing mode as Remote as shown in below, 
 
Index.cshtml 
 
<button type="button" id="samplebtn">Set Parameter</button> 
<ej-report-viewer id="reportviewer1" report-service-url="/Home" report-path="Region.rdlc" processing-mode="Local" ajax-before-load="ajaxBeforeLoad"></ej-report-viewer> 
 
<ej-script-manager> 
 
</ej-script-manager> 
 
<script type="text/javascript"> 
    var parameter = null; 
    $("body").on("click", "#samplebtn", function () { 
        parameter = [{ 
            name: 'CustomerID', 
            labels: ['29661'], 
            values: [29661], 
            nullable: false 
        }]; 
 
        var reportViewer = $('#reportviewer1').data("ejReportViewer"); 
        reportViewer.setModel({ 
            parameters: parameter 
        }); 
    }); 
</script> 
 
If you are using RDLC report with datasource processing locally, we can achieve your requirement by passing the value from client to server side by using the ajax-before-load event as shown in below code example, 
 
Index.cshtml 
 
<button type="button" id="samplebtn">Set Parameter</button> 
<ej-report-viewer id="reportviewer1" report-service-url="/Home" report-path="Region.rdlc" processing-mode="Local" ajax-before-load="ajaxBeforeLoad"></ej-report-viewer> 
 
<ej-script-manager> 
 
</ej-script-manager> 
 
<script type="text/javascript"> 
    var parameter = null; 
    $("body").on("click", "#samplebtn", function () { 
        parameter = [{ 
            name: 'CustomerID', 
            labels: ['29661'], 
            values: [29661], 
            nullable: false 
        }]; 
 
        var reportViewer = $('#reportviewer1').data("ejReportViewer"); 
        reportViewer.setModel({ 
            parameters: parameter 
        }); 
    }); 
 
    function ajaxBeforeLoad(event) { 
        event.data = parameter; 
    } 
</script> 
 
Then you can receive the parameters in PostReportAction WebAPI controller in CustomData attribute and store in variable and access in Report Loaded as shown in below, 
 
WebAPI Controller: 
 
        public string DefaultParam = null; 
        [HttpPost] 
        public object PostReportAction([FromBody] Dictionary<string, object> jsonResult) 
        { 
            if (jsonResult.ContainsKey("CustomData")) 
            { 
                DefaultParam = jsonResult["CustomData"].ToString(); 
            } 
            return ReportHelper.ProcessReport(jsonResult, this, this._cache); 
        } 
 
        [ActionName("GetResource")] 
        [AcceptVerbs("GET")] 
        public object GetResource(ReportResource resource) 
        { 
            return ReportHelper.GetResource(resource, this, _cache); 
        } 
 
        [HttpPost] 
        public object PostFormReportAction() 
        { 
            return Syncfusion.EJ.ReportViewer.ReportHelper.ProcessReport(null, this, this._cache); 
        } 
 
        public void OnInitReportOptions(ReportViewerOptions reportOption) 
        { 
            string basePath = _hostingEnvironment.WebRootPath; 
            FileStream inputStream = new FileStream(basePath + @"\ReportData\Region.rdlc", FileMode.Open, FileAccess.Read); 
            reportOption.ReportModel.Stream = inputStream; 
            reportOption.ReportModel.ProcessingMode = Syncfusion.EJ.ReportViewer.ProcessingMode.Local; 
        } 
 
        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.Clear(); 
                reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "StoreSales", Value = StoreSales.GetData(Convert.ToInt32(parameters[0].Values[0])) }); 
            } 
            else 
            { 
                reportOption.ReportModel.DataSources.Clear(); 
                reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "StoreSales", Value = StoreSales.GetData(Convert.ToInt32("29825")) }); 
            } 
        } 
 
Please find the simple sample with parameter values passed to the report from below location, 
 
 
 
 
Regards, 
Mageshyadav.M 



KL Kenneth Lo November 8, 2018 04:27 AM UTC

Hi Mageshyadav,

Thank you for your quick response.  I have tried your solution and I am able to display and set the parameters.  However, that introduces another issue for the report.  I set up the report to follow the guideline from Syncfusion regarding page size and body size.  My report is generated normally in print layout preview inside the report viewer.  When I proceed to print, the print preview results in wrong margins, and the page contents are being shifted to the left.  In addition, if I set the sum of top margin, bottom margin, page harder, page footer and body close to the report height, the print out will extend to 2 pages and my page header will be displayed on the second page.  This is a major as I would like to generate letters with page header and page footer that are close to the top and bottom margin.

I have attached a sample report files for you to investigate.  Thank you for your attention.

Regards,

Kenneth Lo

Attachment: Report_Print_output_8e64cfa9.zip


MM Mageshyadav M Syncfusion Team November 12, 2018 09:34 AM UTC

Hi Kenneth, 
 
We were able to reproduce the page content shifting to left margin and extra page issue at our end. This issue will be fixed in our upcoming 2018 Volume 4 release. As of now you can set “ConsumeContainerWhitespace” as true in the Report Properties to resolve the extra page issue alone.  
 
  1. Please click outside of the report for “Report” properties.
 
  1. In property grid please set “ConsumeContainerWhitespace” as “True” as shown in the below snapshot.
 
 
 
Regards, 
Mageshyadav.M

Loader.
Up arrow icon