Sunday 1 April 2012

An event which fires in ReportViewer after the report is generated


I searched for quite a while to find a way to run a client side script whenever the ASP.Net SSRS ReportViewer control has finished rendering/generating a report.  I could not find one documented but when looking in the report viewers resulting html source I found mention of ClientController.CustomOnReportLoaded which was set to an empty function.  Using the JQuery ready function I was able to attach code to this event and have it run only after the report was generated.


$(document).ready(function () {

document.getElementById('ctl00_ctl00_DefaultContent_AdminContent_reportViewer').ClientController.CustomOnReportLoaded = function () {

        alert('You see this after Report is Generated');
        }
        });

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. How can i find the id of my report in html source? a try this example using the id of asp.net but doesnt work.

      Delete