473,856 Members | 1,616 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 3581
"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
4524
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
2646
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
2580
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
20550
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
2706
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
4403
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
4577
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
2072
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
9416
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
10699
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...
1
10790
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10390
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
9535
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...
1
7932
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
5762
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
5960
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4176
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3203
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.