Showing and hiding progress indicator while downloading exported file

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

    Posted 27 Aug 2012 Link to this post


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

    Tested only on IE9.

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

    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
    27 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!

  4. Kalai
    Kalai avatar
    6 posts
    Member since:
    May 2019

    Posted 05 Sep 2019 in reply to croach01 Link to this post


    Here your are showing export icon in RadGrid property ("<CommandItemSettings ShowExportToExcelButton="true"/>"). Same thing i implemented export in separate image button(Out side grid). I want to show ajax loading until the file export. PFB my code.



  5. Kalai
    Kalai avatar
    6 posts
    Member since:
    May 2019

    Posted 05 Sep 2019 in reply to Kalai Link to this post

Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.