473,548 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CSV download problem from window.showModa lDialog( ) opened page.

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();
%>

Feb 9 '06 #1
2 4381
VK
Message-ID: <XF************ ********@news20 .bellglobal.com >

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

Feb 9 '06 #2

"VK" <sc**********@y ahoo.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Message-ID: <XF************ ********@news20 .bellglobal.com >

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


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="ifrTarg et">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();">Clos e</button>
</p>
</body>
</html>
------------------------------------------------
Feb 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2319
by: Steve Mauldin | last post by:
This is a standard ASP application that has several pages at the root withthe global.asa. I set a session variable session("accountid") = "123456" within an asp page and then response.redirect to the next page and immediately response.write session("accountid") and I get back nothing. But if I set a session variable session("accountid") =...
0
1325
by: djus | last post by:
Hello At the begining I'm sorry for my English :( I want my aspx page TestPage.aspx to inherit from MyClass2. MyClass2 inherits from MyMainClass which is subtype of Page: public class MyMainClass : Page public class MyClass2 : MyMainClass
0
1042
by: Wictor Wilén | last post by:
Heya, I need help creating a download page that should be used to download files from a server, and the files on the server contains filenames that contains non-us characters such as the swedish å. ä and ö. The aspx file should work like this: download.aspx?file=c:\download\åäö.doc If I choose to save the file it works ok but if I...
5
2763
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the...
3
1321
by: Jeff Jarrell | last post by:
I want to setup a downloads page on my site. Most of the time they are zip files but they are also MSI files. Things work ok if I simply put an <a> element referencing the file to download but I'd like a little more smarts to it. I'd like to know how many times the file was downloaded along with the referrer information. I'd also like to...
1
1686
by: Brett Kelly | last post by:
Ok, I know this sounds odd. Let me explain further. I have an ASP.net page (w/ C# code behind) that, when given a session variable containing the path to a local file, will attempt to start the download of that file for the user. Here's the content of my Page_Load: protected void Page_Load(object sender, EventArgs e) {
3
2102
by: kosmodisk | last post by:
Hi, I'm having problem accessing javascript-created elements from opened window. This occurs only when I'm including another files in opened window, javascript or css. When I comment out "<link>" and "<script>" (point (0)), the script works fine. The opening window itself (point (1)) can access the object. When page has been loaded, then...
4
1606
by: igotyourdotnet | last post by:
Is there a way to pass data from page to page without the use of a Session Variable or queryString? I need to pass drop down box selections from page to page and have the drop downs on the page be the same as they were on the page the user is coming from. I'm using a master page and a sitemap file for my menu. example: If I'm in page 1 and...
1
1373
by: Zuhaib Hyder | last post by:
how to logout from frame window/page to normal window/page (no frame)? and how to open new normal page(no frame) from frame page?
0
7512
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7438
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7707
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3495
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
751
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.