J
John
Hi,
I'm having a problem opening / downloading csv files when called from a page
opened with window.showModalDialog( ).
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 away around this?
I would like to keep 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();
%>
I'm having a problem opening / downloading csv files when called from a page
opened with window.showModalDialog( ).
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 away around this?
I would like to keep 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();
%>