Solved

redirect page After writing out response in excel

Posted on 2008-10-23
4
377 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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 is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 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