Showing page loader while exporting a report

4 posts, 0 answers
  1. Paul
    Paul avatar
    3 posts
    Member since:
    Apr 2014

    Posted 06 Apr 2014 Link to this post

    I'd like to be able to put a full page loader while our application is exporting a previously rendered & currently displaying report to pdf / excel. This means being able to run client side code once the export has finished. Is this possible?

    We have our current report viewer set up as follows:

     <telerik:ReportViewer ID="Viewer" runat="server" 
                Width="100%" Height="100%" ClientIDMode="Static"
                ParametersAreaVisible="False" ViewMode="PrintPreview"
                ToolbarVisible="false" DocumentMapVisible="false" Skin="Promapp" SkinsPath="~/Content/Skins">
            </telerik:ReportViewer>

    When the user clicks on the PDF icon above this viewer we call this javascript code:

    ExportReport: function (exportType) {
            if (typeof Viewer === "undefined") { return; }
            Viewer.ExportReport(exportType);
        },


    So, ideally what I'd like to do is in this ExportReport function call our existing Loader() jquery function, and then have a callback function defined once the export has completed which can have our existing LoaderRemove() function. How exactly can I define this callback - is there an OnReportExported event?

    Other threads have mentioned as a possibility to define a custom server-side function in our code that will export the report programatically as explained here (http://www.telerik.com/help/reporting/programmatic-exporting-report.html). We could then have our own ajax call to an action that will do this. However, from this post it is not clear how to exactly pass in the currently displayed report instance - since that is already rendered on the screen prior to the user being able to click the export button. How exactly do you pass in this report instance? Is there an ID or something you can pass in, and a telerik method that you can call to retrieve it?

    Thanks to anyone who can reply.

    Paul


  2. Stef
    Admin
    Stef avatar
    3046 posts

    Posted 09 Apr 2014 Link to this post

    Hello Paul,

    You can use the ASP.NET ReportViewer Client-Side API, which methods will be enabled when the viewer is fully loaded. You can ping on an interval to check if the viewer is done loading its content.

    With the approach with programmatic exporting, you can pass to the ReportProcessor a new instance of the currently rendering report, and export it on the server. Finally the document, can be sent back to the client.

    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Paul
    Paul avatar
    3 posts
    Member since:
    Apr 2014

    Posted 09 Apr 2014 in reply to Stef Link to this post

    Hi Stef,

    Thanks for replying but that doesn't really answer my original question. It's still not clear exactly how you can use the client side API to check if the report has finished being exported. You can check if the report is loaded, and you can call the method to export the report, but how can you see if it has actually finished exporting?

    As for programmatic exporting, you've just explained what I'm trying to do but not how. How EXACTLY do you do pass the instance of the currently rendering report into that code? I imagine that code in the link would be set up inside action method on the server side code, so how exactly do you code the client side ajax request to pass in the required parameters, and what is the name of the object that is the parameter on this action method? Have you got any example code to make this clear?

    Thanks,
    Paul
  5. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 14 Apr 2014 Link to this post

    Hello Paul,

    The exported document will be returned as an attachment. Thus, it is not possible to subscribe to an event like like OnReportExported or similar and there is no event fired when the rendering of the report has finished in the ASP.NET Report Viewer.

    Regards,
    Nasko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top