Showing and hiding progress indicator while downloading exported file

Thread is closed for posting
5 posts, 0 answers
  1. FB8C7104-28BD-442C-B5A5-8AEC35B0C675
    FB8C7104-28BD-442C-B5A5-8AEC35B0C675 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. 272EA702-B83F-49DA-9608-0FBC5A6ECAEB
    272EA702-B83F-49DA-9608-0FBC5A6ECAEB avatar
    4017 posts
    Member since:
    Oct 2016

    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. 4606638F-944C-42D3-B603-CBE3F1AE5391
    4606638F-944C-42D3-B603-CBE3F1AE5391 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!

    Curtis
  4. 8119EFA1-1162-40DE-BF49-B98F264784D7
    8119EFA1-1162-40DE-BF49-B98F264784D7 avatar
    6 posts
    Member since:
    May 2019

    Posted 05 Sep 2019 in reply to FB8C7104-28BD-442C-B5A5-8AEC35B0C675 Link to this post

    Hi,

    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. 8119EFA1-1162-40DE-BF49-B98F264784D7
    8119EFA1-1162-40DE-BF49-B98F264784D7 avatar
    6 posts
    Member since:
    May 2019

    Posted 05 Sep 2019 in reply to 8119EFA1-1162-40DE-BF49-B98F264784D7 Link to this post

    Attachement
Back to Top

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