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

Render ReportViewer on demand

Thread ID:

Created:

Updated:

Platform:

Replies:

121342 Dec 3,2015 08:19 AM UTC Dec 14,2015 06:05 AM UTC ASP.NET MVC 3
loading
Tags: ReportViewer
Liviu
Asked On December 3, 2015 08:19 AM UTC

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.


Soundara Rajan S [Syncfusion]
Replied On 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.

Liviu
Replied On 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.





Soundara Rajan S [Syncfusion]
Replied On 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

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.

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

;