Solved

redirect page After writing out response in excel

Posted on 2008-10-23
4
370 Views
Last Modified: 2008-10-27
I have a html file containing a form that allows user to enter start date and end date that are relevant for retrieiving a recordset.  When the user click on the submit button on the form, a wait message will be displayed and then the data is submitted to an ASP page that process the request by querying the database using the supplied parameters of dates.   In that ASP page the response contenttype has been changed to application/vnd.ms-excel so that the recordset can be written out in excel format.  As a result, a diaglog box always appears asking user if they want to save/open the file (or cancel the transaction).   However, when the diaglog box appears, the browser is still showing the wait message of the html file that calls the ASP page.   Is there anyway to redirect the page after the save diaglog box appears so that the user won't see the wait message any longer?
0
Comment
Question by:ayc8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 7

Expert Comment

by:bluV11t
ID: 22788914
I guess you could use a javascript with a timeout to redirect the page in lets say 5 seconds. Of course the page will always redirect after 5 seconds but I don't think it will interfere with the excel file. Put this in  the head tag of your wait message page:
<script language=javascript>
function fnRedir(){
location.href='url_of_page_to_redirect_to';
}
</script>
 
 
//Put this into the onClick event of the button showing the wait message or the (javascript) function showing the wait message:
 
timerID = setTimeout('fnRedir()', 5000);

Open in new window

0
 

Author Comment

by:ayc8
ID: 22789551
Hi bluV11t:
thank you very much for your quick reply. However, what I was hoping to accomplish is that  once the downloading processing is complete in the ASP page that renders the response in excel, the calling page (the html page with the wait message) will refresh itself  so that the wait message will not be there any more. I have tried doing a Response.Redirect (back to the calling page) in the ASP page, but that does not do the trick (It works if I put this before Response.Flush() at the end of this page, but the page won't render the response). I have even tried using javascript by attaching an onload event  to the ASP page so that the document location will be changed back to the calling page to the ASP page. That code didn't seem to execute. It seems that once I set the response header to application/vnd.ms-excel, any javascript code is ignored. Any idea what I can do to fix this?
0
 
LVL 7

Expert Comment

by:bluV11t
ID: 22789636
Did you try Response.Flush() after binarywriting the excel and then add new header (text/html) and some html after that? If that works i think you could add some javascript on the asp page to remove the waiting message on the html page... It sounds like a crazy idea, I'll have to test it at work tomorrow :-D
0
 
LVL 7

Accepted Solution

by:
bluV11t earned 500 total points
ID: 22794894
Tried it now, it had no effect...
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Writing lines of code from a form output in script within a results page 2 44
ASP server side get value 15 50
2012 SQL to JSON Select 5 44
ASP Error Handler 5 34
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question