Connecting Tech Pros Worldwide Help | Site Map

CSV download problem from window.showModalDialog( ) opened page.

 
LinkBack Thread Tools Search this Thread
  #1  
Old February 9th, 2006, 09:05 PM
John
Guest
 
Posts: n/a
Default CSV download problem from window.showModalDialog( ) opened page.

Hi,

I posted this earlier in microsoft.public.dotnet.framework.aspnet, but
didn't get a response, so I thought I'd try here.

Basically, I'm having a problem opening / downloading csv files when
generated from within a page opened with window.showModalDialog( ) ( IE6 ).

To isolate this problem, I've written 3 files (see below).
1. main.htm allows the user to open the page containing the link in a
regular window or one opened via window.showModalDialog( )
2. modal.htm provides a link to the aspx which generates the csv
3. csv.aspx generates a csv file

When I open modal.htm with window.showModalDialog( ), clicking the link does
nothing.
When opened in a normal window, clicking the link opens / downloads the
generated csv.

Does anybody know how I can get the generated file to download while keeping
the modal window?

Thanks in advance,
John

------------------------------------------------------------
-- main.htm
------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script language="javascript">
function openModalDlg()
{
window.showModalDialog( "modal.htm", "",
"dialogHeight:200px;dialogWidth:400px;");
}
</script>
</head>
<body>
<p>
Click <a href="#" onclick="openModalDlg();">here</a> to open modal dialog
</p>
<p>
Click <a href="modal.htm" target="_blank">here</a> to open in regular
window
</p>
</body>
</html>

------------------------------------------------------------
-- modal.htm
------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<base target="_self">
</head>
<body>
<p>
Click <a href="csv.aspx">here</a> to generate csv file from this page.
</p>
<p>
<button onclick="window.close();">Close</button>
</p>
</body>
</html>

------------------------------------------------------------
-- csv.aspx
------------------------------------------------------------
<%
// set export header
Response.ContentType = "Application/x-msexcel";
Response.AddHeader("content-disposition",
"attachment;filename=test.csv");

Response.Write( "\"Col A\",\"Col B\",\"Col C\"");
Response.Write( Environment.NewLine);
Response.Write( "1,2,3");
Response.Write( Environment.NewLine);
Response.Write( "4,5,6");
Response.Write( Environment.NewLine);
Response.Write( "7,8,9");
Response.Write( Environment.NewLine);
Response.End();
%>




  #2  
Old February 9th, 2006, 10:35 PM
VK
Guest
 
Posts: n/a
Default Re: CSV download problem from window.showModalDialog( ) opened page.

Message-ID: <XFOGf.38057$1e5.677411@news20.bellglobal.com>

<http://www.peterprovost.org/archive/2003/05/20/483.aspx>

  #3  
Old February 10th, 2006, 01:55 PM
John
Guest
 
Posts: n/a
Default Re: CSV download problem from window.showModalDialog( ) opened page.


"VK" <schools_ring@yahoo.com> wrote in message
news:1139527609.434440.256190@g47g2000cwa.googlegr oups.com...[color=blue]
> Message-ID: <XFOGf.38057$1e5.677411@news20.bellglobal.com>
>
> <http://www.peterprovost.org/archive/2003/05/20/483.aspx>
>[/color]

Thanks VK,

That worked great.

For the record; here is my new modal.htm file
-----------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<base target="_self">
</head>
<body>
<p>
Click <a href="csv.aspx" target="ifrTarget">here</a> to generate csv file
from this page.
<iframe name="ifrTarget" id="ifrTarget" width="0" height="0"></iframe>
</p>
<p>
<button onclick="window.close();">Close</button>
</p>
</body>
</html>
------------------------------------------------


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.