Hi,
I posted this earlier in microsoft.publi c.dotnet.framew ork.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.showModa lDialog( ) ( 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.showModa lDialog( )
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.showModa lDialog( ), 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="javas cript">
function openModalDlg()
{
window.showModa lDialog( "modal.htm" , "",
"dialogHeight:2 00px;dialogWidt h:400px;");
}
</script>
</head>
<body>
<p>
Click <a href="#" onclick="openMo dalDlg();">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();">Clos e</button>
</p>
</body>
</html>
------------------------------------------------------------
-- csv.aspx
------------------------------------------------------------
<%
// set export header
Response.Conten tType = "Applicatio n/x-msexcel";
Response.AddHea der("content-disposition",
"attachment;fil ename=test.csv" );
Response.Write( "\"Col A\",\"Col B\",\"Col C\"");
Response.Write( Environment.New Line);
Response.Write( "1,2,3");
Response.Write( Environment.New Line);
Response.Write( "4,5,6");
Response.Write( Environment.New Line);
Response.Write( "7,8,9");
Response.Write( Environment.New Line);
Response.End();
%>