Hi,
I generate a report in a comma delimited file and give it
a name like MyReport.csv . I then set a Hyperlink
control to point tp the file
HyperLink1.text = "Download"
Hyperlink1.NavigateUrl = "MyReport.csv"
When the user clicks the HyperLink I would always like to
see the dialog come up that asks if you want to 'Open' the
file or 'Save' the file to disk.
I get mixed results. If the client has Excel installed
then this dialog does not come up and IE pops the file
into a spread sheet. If Excel is not installed then IE
pops the file up in a text window (same thing happens if I
delete the csv from the folder options).
If I change the file extension to something strange
like .xyz123 then it always comes up with the dialog but
I want the user to have the option to save the file as
csv.
Anyway, is there some way to force this to always come up
with the Open or Save dialog?
Tks,
JOhn 4 5029
Not that i know of. Users can force the dialog manually by right clicking /
Save Target As. Either that or just zip the file.
-Trevor
"John" <jc*******@dashgroup.com> wrote in message
news:01****************************@phx.gbl... Hi,
I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file
HyperLink1.text = "Download" Hyperlink1.NavigateUrl = "MyReport.csv"
When the user clicks the HyperLink I would always like to see the dialog come up that asks if you want to 'Open' the file or 'Save' the file to disk.
I get mixed results. If the client has Excel installed then this dialog does not come up and IE pops the file into a spread sheet. If Excel is not installed then IE pops the file up in a text window (same thing happens if I delete the csv from the folder options).
If I change the file extension to something strange like .xyz123 then it always comes up with the dialog but I want the user to have the option to save the file as csv.
Anyway, is there some way to force this to always come up with the Open or Save dialog?
Tks, JOhn
Try creating an ASPX page that opens and reads the file, and then sets the
Response.ContentType property to "application/octet-stream" and then
Response.BinaryWrite()s the file to the output stream. Then you can link to
this file, and you should get the desired effect.
HTH,
Kevin Spencer
Microsoft FrontPage MVP
Internet Developer http://www.takempis.com
Big things are made up of
lots of Little things.
"John" <jc*******@dashgroup.com> wrote in message
news:01****************************@phx.gbl... Hi,
I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file
HyperLink1.text = "Download" Hyperlink1.NavigateUrl = "MyReport.csv"
When the user clicks the HyperLink I would always like to see the dialog come up that asks if you want to 'Open' the file or 'Save' the file to disk.
I get mixed results. If the client has Excel installed then this dialog does not come up and IE pops the file into a spread sheet. If Excel is not installed then IE pops the file up in a text window (same thing happens if I delete the csv from the folder options).
If I change the file extension to something strange like .xyz123 then it always comes up with the dialog but I want the user to have the option to save the file as csv.
Anyway, is there some way to force this to always come up with the Open or Save dialog?
Tks, JOhn
Thanks, this seems to work. One small problem, when you
clict 'Open' it repeats the dialog and you need to click
Open a second time. But, much better than before. -----Original Message----- It is a tricky problem, most browsers try to do whatever
they can dependingon the type of file. However, it is possible to override the headers of the
output to convincethe browser that it should try and do something else with
it. Instead of just a hyperlink url, generate a control
(button / imagebuttonetc) with an event / postback Then within the server side code (OnClick) use the
following with theResponse object.
Response.AppendHeader( "content-disposition", "attachment; filename=MyReport.csv"); Response.WriteFile(Server.MapPath
("MyReport.csv")); Response.End();
Regards, Robin
"John" <jc*******@dashgroup.com> wrote in message news:01****************************@phx.gbl... Hi,
I generate a report in a comma delimited file and give
it a name like MyReport.csv . I then set a Hyperlink control to point tp the file
HyperLink1.text = "Download" Hyperlink1.NavigateUrl = "MyReport.csv"
When the user clicks the HyperLink I would always like
to see the dialog come up that asks if you want to 'Open'
the file or 'Save' the file to disk.
I get mixed results. If the client has Excel installed then this dialog does not come up and IE pops the file into a spread sheet. If Excel is not installed then IE pops the file up in a text window (same thing happens
if I delete the csv from the folder options).
If I change the file extension to something strange like .xyz123 then it always comes up with the dialog
but I want the user to have the option to save the file as csv.
Anyway, is there some way to force this to always come
up with the Open or Save dialog?
Tks, JOhn
.
Sorry about blank reply!! Ack, itchy fingers!
Strange, check that there are no other Response Redirects or Url links as
part of this control. Also, maybe try clearing the Response object before
adding the new header and writing the file.
In general whenever I find I need to force the use to do a save as (as
below) I usually provide two buttons, one for save, one for open. The save
forces the dialog and the open just does a response.redirect. That way they
never have the need to click the Save button and then try and open it.
"john" <jc*******@dashgroup.com> wrote in message
news:0c****************************@phx.gbl... Thanks, this seems to work. One small problem, when you clict 'Open' it repeats the dialog and you need to click Open a second time. But, much better than before.
-----Original Message----- It is a tricky problem, most browsers try to do whatever they can dependingon the type of file. However, it is possible to override the headers of the output to convincethe browser that it should try and do something else with it. Instead of just a hyperlink url, generate a control
(button / imagebuttonetc) with an event / postback Then within the server side code (OnClick) use the following with theResponse object.
Response.AppendHeader( "content-disposition", "attachment; filename=MyReport.csv"); Response.WriteFile(Server.MapPath ("MyReport.csv")); Response.End();
Regards, Robin
"John" <jc*******@dashgroup.com> wrote in message news:01****************************@phx.gbl... Hi,
I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file
HyperLink1.text = "Download" Hyperlink1.NavigateUrl = "MyReport.csv"
When the user clicks the HyperLink I would always like to see the dialog come up that asks if you want to 'Open' the file or 'Save' the file to disk.
I get mixed results. If the client has Excel installed then this dialog does not come up and IE pops the file into a spread sheet. If Excel is not installed then IE pops the file up in a text window (same thing happens if I delete the csv from the folder options).
If I change the file extension to something strange like .xyz123 then it always comes up with the dialog but I want the user to have the option to save the file as csv.
Anyway, is there some way to force this to always come up with the Open or Save dialog?
Tks, JOhn
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andras Gilicz |
last post by:
Hi VB fans
I'm working on a relatively large project in VB6 with about a dozen
forms, including graphs, labels, text boxes, etc. The software itself
is actually a flow simulator with more or...
|
by: Newbie |
last post by:
I am trying to get the save/open dialog figured out. I am able open the save
dialog but when I put in a file name (whatever.txt) and save the file does
save with the name but it is blank. Below...
|
by: Dune |
last post by:
Hi there,
I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they...
|
by: Mike |
last post by:
can i open the save file dialog box from a asp.net web page?
thx
|
by: sunilj20 |
last post by:
Hello,
I have a requirement wherein, a user clicks on a file name in an
ASP.NET web application, and the file should automatically be
downloaded (Without showing the "Open", "Save As") in the...
|
by: Patrick |
last post by:
Following on from the excellent example at
http://www.c-sharpcorner.com/Code/2003/Sept/ExportASPNetDataGridToExcel.asp
on how to save a data-grid to excel file, how can I extend the example such...
|
by: Michael Groeger |
last post by:
Hi,
I have an aspx page which generates an excel document and transfers it to
the browser as attachment. Normally, once the document is transferred the
open save dialog prompts to open or save...
|
by: Rameel |
last post by:
Friends,
I'm probably being more critical with VB.Net Windows application.
I have Developed VisualStudio 20005 VB.Net Windows application
how willl i be able to save a specific record into my...
|
by: squrel |
last post by:
Hello everyone,
I m using some button using toolbar such as Add,Save,View,.... my save button is not working.... it doesnt give me any error but does not save to my database.... or showing in my...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |