Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Exporting to Excel from a Modal IE Window

Posted on 2005-04-07
4
Medium Priority
?
835 Views
Last Modified: 2012-06-21
I have the following code to export binary data in a modal window that is opened using javascript window.showmodaldialog():

        Dim result() As Byte
        ...
        Response.ClearContent()
        Response.ClearHeaders()
        Response.ContentType = "application/vnd.ms-excel"
        Response.AddHeader("Content-Disposition", "attachment; filename=" & sFilename & "")
        Response.BinaryWrite(result)
        Response.End()

The problem is that it opens a blank window where it opens up the Save/Open dialog.  And I do not want another window opening up.  Everything works fine when I try to export from an ordinary window.

I've tried putting <base target=_self> in my aspx file.  What happens is the modal window seems to just refresh itself, but the Save/Open dialog doesn't appear anymore.

Help please.

Thanks.
0
Comment
Question by:gtmljsc
  • 2
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
dfu23 earned 400 total points
ID: 13732955
Good question, maybe try getting tricky ... like putting an IFRAME in the modal window that loads the excel ... not sure of why it does not load offhand but try some quick workarounds to see if there is a way to hack it and get it to do what you want it to do.

Does it have to be a modal window? Can a normal window with some javascript accomplish the same thing?
0
 
LVL 1

Author Comment

by:gtmljsc
ID: 13733053
Our client wants it to be a modal window.

Anyways, here's what I really have:  

I do have an IFrame in my modal window, and it's created at runtime.  The content of the IFrame is a report generated by SQL 2000 Reporting Service.  Outside the IFrame is a an Export Button, which calls another method to render the report in Excel format, output as  binary data into my byte variable, result.  And then I use the code above to "export" the data as an Excel file.

I tried creating another IFrame F2, and putting <base target="F2"> in my aspx page.  It didn't work still.  It still opens up a new window.

Should my button be inside another iFrame?  If it is inside another IFrame, can it still access the query strings passed on to the main modal window?

Thanks.
0
 
LVL 1

Author Comment

by:gtmljsc
ID: 13733505
Everything's working now... I had to put my button inside another IFrame and call my export function from there.  But I also had to retransfer my query string again to the page in my new IFrame.  It's pretty messy, but it works!

Thanks dfu23.
0
 
LVL 14

Expert Comment

by:dfu23
ID: 13741101
No problem ... glad you were able to get to work!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

564 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