Showing and hiding progress indicator while downloading exported file

3 posts, 0 answers
  1. croach01
    croach01 avatar
    22 posts
    Member since:
    Aug 2007

    Posted 27 Aug 2012 Link to this post

    Requirements

    RadControls version
    2012.2.724.40
    .NET version 4.0
    Visual Studio version 2010
    programming language                C#
    browser support

    Tested only on IE9.


    PROJECT DESCRIPTION
    This project demonstrated the showing and hiding of a RadAjaxLoadingPanel during the download of an exported file.  I've implemented the idea explained here.  The attached project is a sample website using the Northwind database to display records in a RadGrid.  When you click any of the export buttons, the requestStart event of the ajax panel is triggered which causes a timestamp to get written to a HiddenField.  A timer is also started in order to check for a cookie that is sent from the server once the export process is finished.  On the server, the GridExporting event is handled at which point a cookie is written to the response stream with the timestamp previously sent from the client.  Once the client confirms that the timestamp exists in the response's cookie, it clears the timer, hides the RadAjaxLoadingPanel and clears the cookie.  

    Cookies must be enabled on the client in order for this method to work.  The RadGrid.ExportSettings.OpenInNewWindow must be set to true for this method to work.  

    In this example, I use the RadAjaxLoadingPanel, though you should be able to use any other loading graphic or jQuery plugin to accomplish the same thing.  While a timestamp is used for identifying the request on the client, it shouldn't be relied upon to get the time it takes to generate a report, as the client doesn't check for the cookie until AFTER the file has finished downloading.

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 30 Aug 2012 Link to this post

    Hi Casey,

    Thank you for sharing your example and providing this great approach for showing LoadingPanel during export.
    As a token of gratitude I have updated your telerik points. 


    Regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Curtis
    Curtis avatar
    23 posts
    Member since:
    Jan 2008

    Posted 28 Sep 2012 Link to this post

    Casey, you absolutely rock. This is an amazing solution and one I've seen people search for all over on the Internet. I have worked for hours trying to come up with a solution but had no idea that cookie's could also be written to the headers in addition to the file information.

    I am SO thankful my quest for a solution is over!

    Curtis
Back to Top