473,770 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

No download from link, when pg opened via window.showModa lDialog( )

Hi,

I'm having a problem opening / downloading csv files when called from a page
opened with window.showModa lDialog( ).

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 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="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
1 3577
"John" <pl*@dont.spam. me.com> wrote in message
news:iz******** ************@ne ws20.bellglobal .com...
Hi,

I'm having a problem opening / downloading csv files when called from a
page opened with window.showModa lDialog( ).

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.
.....

Just an FYI for future reference.

This problem was resolved comp.lang.javas cript
http://groups.google.com/group/comp....e91e2bf88c4034

Regards,
John
Feb 10 '06 #2

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

Similar topics

1
4520
by: marty | last post by:
I have a webpage that displays data from a SQL database in table format. I found information on how to create a way to allow a user to download this information to Excel using 'Header()' in the PHP code. Header("Content-Type: application/vnd.ms-excel"); Header("Content-Disposition: attachment; filename=\"filename.xls\""); I setup a link on the display page that sends the variables needed for the SQL query to a different PHP page and...
4
2643
by: geradeaus | last post by:
Hi, I use a php class to create pdf files (http://www.ros.co.nz/pdf/) ... but when I download the created pdf, the browser window closes, and Acrobat opens. How do I prevent the closing of the original browser window? Maybe it has something to do with cache, because most off the people using the website don't have this problem.
4
2574
by: Marco | last post by:
I made an html-page with this line in it: <A HREF="http://www.bla.com" onClick="javascript:window.close()" target="moeder">link</A> It works very well in Internet Explorer, but in Netscape 7 the url isn't opened in the moeder window. How come and how can I fix it so it works in Netscape too? Thanks in advance for any answers. Mrco
3
20548
by: Michael | last post by:
I am trying to allow a user to view a PDF in a new window. I currently have this working using the following: <a href="./pdf.do?parameter=01121980" target="top"><b>pdf</b></a> The problem with the above solution is the back/forward buttons and all the other browser options. Because of this, I am trying to get the following solution to work: <a href="#" onclick="popUp('./pdf.do?parameter=01121980')"><b>pdf</b></a>
4
2703
by: Hitesh | last post by:
Hi, I am having a requirement where in user can click on a link and the download popup appears and then user should be redirected to a congratulations page. We didn't bother whether the download is successful or not but as soon as user clicks on the download link the popup appears, and then the user should be directed to the congratulations page. I have written the standard code to download the file but after that i am
2
4397
by: John | last post by:
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
4
4576
by: =?Utf-8?B?Sm9hbyBSZWdv?= | last post by:
Hello, Using asp.net 2.0, C# and IE7 I'm using window.showModalDialog to open a modal window on the client from Javascript. I have to include this line in the < HEAD html of the modal window: <base target=_selfbecause whenever that page posted back, it would spawn off a new window!! This is the beaviour in IE7.
0
2066
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have to open a bunch of pages as diaogboxes, I created a general page(Container.aspx) which has an...
1
9411
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have to open a bunch of pages as diaogboxes, I created a general page(Container.aspx) which has an...
0
9595
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9873
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
8891
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 project—planning, coding, testing, and deployment—without 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...
0
6682
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();...
0
5313
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
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
3
2822
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.