Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 10th, 2008, 06:42 PM
Friend of Wrox
Points: 1,243, Level: 13
Points: 1,243, Level: 13 Points: 1,243, Level: 13 Points: 1,243, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2003
Location: , , United Kingdom.
Posts: 290
Thanks: 24
Thanked 0 Times in 0 Posts
Default RESPONSE BUFFER / FLUSH

Hi,

This is the scenario:

I have a button on an aspx page that when the user clicks on it, it will get an xml file and uses xslt to tranform it to an xls file.

After that, the brower will display a pop up and the user can decide to save or open the file in Excel. Please note that to allow the pop up to show I have to change the ContentType and use AddHeaders:

 Response.ContentType = "application/vnd.ms-excel";
 Response.AddHeader("Content-Disposition", "attachment; filename=report.xls");
Response.Write("content......");

Is it possible to create a loading.... message or use a progress bar image while the user waits the web application to create the xls file and then hide the message or image when the pop up shows up in the browser?

I am not sure if this is possible but I would appreciate if someone could shed some light.

Cheers

C
  #2 (permalink)  
Old May 10th, 2008, 08:50 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

A) Move this functionality to another separate page (or even a custom HTTP handler instead of a full web form page).
B) Create a "splash" page with your waiting message. This page will redirect to the new page/handler created in (A).
C) Instead of the postback button, use a regular link to the splash page (B).

The browser will sit on the splash page until the new content comes up. Getting rid of the splash will be a bit more tricky because the behavior of the client will vary by browser. In I.E. with MS Office installed Excel till be embedded right in the I.E. document window and the splash screen will be replaced by it. On Firefox, you'll get a prompt to download/open the file in the appropriate app.

-Peter
compiledthoughts.com
  #3 (permalink)  
Old May 11th, 2008, 12:45 PM
Friend of Wrox
Points: 1,243, Level: 13
Points: 1,243, Level: 13 Points: 1,243, Level: 13 Points: 1,243, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2003
Location: , , United Kingdom.
Posts: 290
Thanks: 24
Thanked 0 Times in 0 Posts
Default

Hi Peter,

Many thanks for your reply.

I was wondering if you could provide some code example or point me to an online tutorial so that I can see how it is done in code?

It is the first time I am trying to achieve something like that and I have to confess that I am strugling.

Cheers

C

  #4 (permalink)  
Old May 11th, 2008, 01:39 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

There are several bits and pieces involved here so you'll have to give me an idea of what you are struggling with in particular. You should be able to find plenty on google (or try http://www.searchdotnet.com for a .NET specific google search) regarding how to redirect (Response.Redirect) and creating custom handlers (.ashx). Far better than what I could write in one reply. Start there and post specific questions as they arise.

-Peter
compiledthoughts.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
Response Buffer to exceed its configured limit er p2pMember Classic ASP Components 0 March 28th, 2006 03:19 AM
response.flush isn't working cookster Classic ASP Basics 6 July 31st, 2004 05:44 AM
How to Flush out Cache on my local computer bekim VB.NET 2002/2003 Basics 1 June 16th, 2004 08:59 AM
Response.Flush jeffm_22 Classic ASP Professional 1 October 20th, 2003 08:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.