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
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.

Render ReportViewer on demand

Hello, 

I'm trying to render the report viewer on demand, collecting the parameters from the view.
I created a partial view with the report content, but it doesn't render:

the view:
@section ScriptSection
{
    <script type="text/javascript">
        function showReport() {
            var reportUrl = $("#hfReportUrl").val();
            $("#report-container").load(reportUrl);
        }
    </script>
}

@section ControlsSection{
    <div style="width: 100%">
        <button type="submit" id="btnShowReport" onclick="showReport()">Show report</button>
        <div id="report-container">
        
        </div>
        
    </div>
    @*@Html.Hidden("hfPartialReportUrl", ViewBag.PartialReportUrl);*@
}     

the partial view:
@using Syncfusion.MVC.EJ
@(
            Html.EJ().ReportViewer("reportviewer")
              .ProcessingMode(Syncfusion.JavaScript.ReportViewerEnums.ProcessingMode.Local).ReportPath("Product Catalog.rdlc")
              .ReportServiceUrl(VirtualPathUtility.ToAbsolute("~/api/RDLCReport"))
)

and for ReportViewerController:
  public ActionResult DocumentMap()
        {
            ViewData["PartialReportUrl"] = Url.Action("RenderDocumentMap");
            return View();
        }

        public ActionResult RenderDocumentMap()
        {
             
            return PartialView("Partial/_DocumentMapPartial");
        }

Any suggestions?  

Thank You.


3 Replies

SR Soundara Rajan S Syncfusion Team December 4, 2015 12:58 PM UTC

Hi Liviu,

Thanks for contacting Syncfusion support.

We need to invoke the ej widget init method to render the ReportViewer controls in AJAX Partial View. So we request you to invoke the init method in AJAX success callback as shown in below code snippet,

$("#performAjax").click(function() {

$.ajax({

type: "POST",

url: "/Report/PartialReport",

contentType: "application/json; charset=utf-8",

error: function (xhr, status, error) {

},

success: function (response) {

$("#Partial").html(response);

ej.widget.init($("#Partial"));

}

});
});



For your reference, we have prepared a sample based on this and it can be downloaded from below location,
http://www.syncfusion.com/downloads/support/directtrac/142175/ReportViewer_Ajax_966df1ce-326593841.zip

Regards,
Soundara Rajan S.


LI Liviu December 11, 2015 02:50 PM UTC

Thank You, it worked fine, just putting the  
ej.widget.init($("#Partial")); 
after loading the partial view.

One more question:

My report does not paginate and it tries to load all the records that generate a js error:
"A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
Script: http://code.jquery.com/jquery-1.10.2.min.js:6"

Any clues on that.

Thank You.






SR Soundara Rajan S Syncfusion Team December 14, 2015 06:05 AM UTC

Hi Liviu,


We have tested the ejReportViewer with shared JQuery and it’s working fine. The paginate error might have occurred due to internal failure of report processing/rendering in the application. So, share the error information with screenshot and referred script file in your application to validate this error.
 
Regards,
Soundara Rajan S

Loader.
Up arrow icon