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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Report loads, but is not displayed

Thread ID:

Created:

Updated:

Platform:

Replies:

142533 Feb 7,2019 09:22 PM UTC Feb 11,2019 12:40 PM UTC ASP.NET Core 3
loading
Tags: ReportViewer
Justin
Asked On February 7, 2019 09:22 PM UTC

I am able to export and print the report, but I can't view it in the browser. In Chrome and Firefox, I see the toolbar, but nothing underneath it.

First I made an rdl with SQL Server 2016 Report Builder, and wondered if there was some sort of compatibility issue so I made a similar rdlc in VS 2017. Both will print and export properly. In Firefox the rdlc will show a a quarter inch of so of the report AFTER I try to print and cancel the print.


OnInitReportOptions() has been modified from the examples I found with my own datasource and datasourcecredentials. I also set it to a local processing.

My View

<ej-report-viewer id="reportviewer1" report-service-url="/Incidents"></ej-report-viewer>

<script type="text/javascript">
    function onReportPrint(args) {
        args.isStyleLoad = false;
    }
</script>


Controller
   public partial class IncidentsController : Controller, IReportController
    {
        private IMemoryCache _cache;
        private IHostingEnvironment _hostingEnvironment;

        public IncidentsController(IMemoryCache memoryCache, IHostingEnvironment hostingEnvironment)
        {
            _cache = memoryCache;
            _hostingEnvironment = hostingEnvironment;
        }

        public ActionResult Index()
        {
         
            return View();
        }

        public IActionResult Error()
        {
            return View();
        }


        [HttpPost]
        public object PostReportAction([FromBody] Dictionary<string, object> jsonResult)
        {
            if (jsonResult.ContainsKey("CustomData"))
            {
                var paramValue = jsonResult["CustomData"];
            }
            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 ReportHelper.ProcessReport(null, this, this._cache);
        }

        public void OnInitReportOptions(ReportViewerOptions reportOption)
        {
            string basePath = _hostingEnvironment.WebRootPath;
            FileStream inputStream = new FileStream(basePath + @"\Incidents.rdlc", FileMode.Open, FileAccess.Read);
            reportOption.ReportModel.Stream = inputStream;
            //DataSet ds = new DataSet();
            //ds = Loadds();
            OdbcConnection connection = new OdbcConnection("Driver={ODBC Driver 17 for SQL Server}; Server=localhost\\SQLEXPRESS;Database=GirlsHaven;Trusted_Connection=Yes;MultipleActiveResultSets=true;ColumnEncryption=Enabled;App=dataset;");
            var strsql = "SELECT * from qryIncidents";
            OdbcDataAdapter adapter = new OdbcDataAdapter(strsql, connection);

            DataSet ds = new DataSet();
            adapter.Fill(ds);
            reportOption.ReportModel.DataSources.Clear();
            reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "DataSet1", Value = ds.Tables[0] });
            DataSourceCredentials dsc = new DataSourceCredentials();
            dsc.ConnectionString = "Driver={ODBC Driver 17 for SQL Server}; Server=localhost\\SQLEXPRESS;Database=GirlsHaven;MultipleActiveResultSets=true;ColumnEncryption=Enabled;app=reportdatasource;";
            dsc.IntegratedSecurity = false;
            dsc.UserId = "*******";
            dsc.Password = "*******";
            dsc.Name = "GirlsHaven";
            reportOption.ReportModel.DataSourceCredentials.Add(dsc);
            reportOption.ReportModel.ProcessingMode = ProcessingMode.Local;
        }

        public void OnReportLoaded(ReportViewerOptions reportOption)
        {

        }
    }


Mahendran Shanmugam [Syncfusion]
Replied On February 8, 2019 06:10 AM UTC

Hi Justin, 

Thanks for your interest in our Syncfusion products. 

We have validated the mentioned RDLC report is not displaying problem in Report Viewer at our end, we are able to preview the reports properly in ASP.NET Core Report Viewer. We have prepared the simple sample to load the RDLC report with business object datasource and it can be downloaded from below location. So could you please confirm whether the below attached sample is working or not at your end.  

If issue still persists then please revert us by modifying the above attached sample to validate the mentioned problem at our end and provide solution at earliest. 

Regards, 
Mahendran S. 


Justin
Replied On February 8, 2019 09:54 PM UTC

The sample worked and the c# all looked the same, so I suspected it was something in my _Layout.cshtml causing the problem. I created a Layout2.cshtml, copied the sample _Layout to it and had my report view use it. That worked, so there must be a script or css reference missing in _Layout.

Ramesh Thangaraj [Syncfusion]
Replied On February 11, 2019 12:40 PM UTC

Hi Justin, 
  
Thanks for the update. We are happy to hear that your issue is resolved. 
  
Regards, 
Ramesh T. 


CONFIRMATION

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

;