473,854 Members | 1,436 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 4402
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
2337
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") = "123456" within an asp page and response.redirect to a page in a sub directory and immediately...
0
1341
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
1047
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 tries to open it the Word Application shows a filename in its title bar that is encoded with the...
5
2799
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 database to get it? Thanks,
3
1332
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 hide the actual physical file location. So I send it to another URL to record the download but...
1
1699
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
2124
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 I can access the object also (point (3)). The script does find included files (debug_test2.css and...
4
1630
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 I select BMW in dropdown 1 and 535 in drop down 2 if i select a new page on the menu, the drop...
1
1387
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
9901
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
11025
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10682
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10371
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9513
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7915
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7082
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4562
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4159
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.