473,233 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,233 software developers and data experts.

Save to file

Following on from the excellent example at
http://www.c-sharpcorner.com/Code/20...ridToExcel.asp
on how to save a data-grid to excel file, how can I extend the example such
that when the user click on the button a popup appear in IE to say "Do you
want to save or open file?"
Nov 19 '05 #1
5 3443
I didn't look into the example.

Generally, to produce a popup request you would need to handle client-side
onclick event in the way:

onclick="return confirm("Do you want to save file?")";

This will open a popup with the question and buttons "Ok" and "Cancel". If
you want another buttons, like "Save" and "Open", you need to make your own
html dialog that will return different values depending on selection.

You can set client-side onclick handler in the code with Attributes
collection.

Eliyahu

"Patrick" <qu*******@newsgroup.nospam> wrote in message
news:F5**********************************@microsof t.com...
Following on from the excellent example at
http://www.c-sharpcorner.com/Code/20...ridToExcel.asp on how to save a data-grid to excel file, how can I extend the example such that when the user click on the button a popup appear in IE to say "Do you
want to save or open file?"

Nov 19 '05 #2
I think you misunderstood. I do NOT want JavaScript popups, but rather the
default Internet Explorer pop-up.

? Some files can harm your computer. If the file information below looks
suspicious, or you do not fully trust the source, do not open or save this
file.
Filename: datagrid.xls
Filetype: Application
From: localhost

Would you like to open the file or save it to the computer?
[Open] [Save] [Cancel] [More Info]

How can I generate the Response so the user get prompted to save or open the
DataGrid as an Excel file instead of opening in the current window by default?

"Eliyahu Goldin" wrote:
I didn't look into the example.

Generally, to produce a popup request you would need to handle client-side
onclick event in the way:

onclick="return confirm("Do you want to save file?")";

This will open a popup with the question and buttons "Ok" and "Cancel". If
you want another buttons, like "Save" and "Open", you need to make your own
html dialog that will return different values depending on selection.

You can set client-side onclick handler in the code with Attributes
collection.

Eliyahu

"Patrick" <qu*******@newsgroup.nospam> wrote in message
news:F5**********************************@microsof t.com...
Following on from the excellent example at

http://www.c-sharpcorner.com/Code/20...ridToExcel.asp
on how to save a data-grid to excel file, how can I extend the example

such
that when the user click on the button a popup appear in IE to say "Do you
want to save or open file?"


Nov 19 '05 #3
Try :
http://support.microsoft.com/kb/260519/en-us
(How to raise a "file download" dialog box for a known mime type).

Patrice

--

"Patrick" <qu*******@newsgroup.nospam> a écrit dans le message de
news:8A**********************************@microsof t.com...
I think you misunderstood. I do NOT want JavaScript popups, but rather the default Internet Explorer pop-up.

? Some files can harm your computer. If the file information below looks
suspicious, or you do not fully trust the source, do not open or save this
file.
Filename: datagrid.xls
Filetype: Application
From: localhost

Would you like to open the file or save it to the computer?
[Open] [Save] [Cancel] [More Info]

How can I generate the Response so the user get prompted to save or open the DataGrid as an Excel file instead of opening in the current window by default?
"Eliyahu Goldin" wrote:
I didn't look into the example.

Generally, to produce a popup request you would need to handle client-side
onclick event in the way:

onclick="return confirm("Do you want to save file?")";

This will open a popup with the question and buttons "Ok" and "Cancel". If you want another buttons, like "Save" and "Open", you need to make your own html dialog that will return different values depending on selection.

You can set client-side onclick handler in the code with Attributes
collection.

Eliyahu

"Patrick" <qu*******@newsgroup.nospam> wrote in message
news:F5**********************************@microsof t.com...
Following on from the excellent example at

http://www.c-sharpcorner.com/Code/20...ridToExcel.asp
on how to save a data-grid to excel file, how can I extend the example

such
that when the user click on the button a popup appear in IE to say "Do you want to save or open file?"


Nov 19 '05 #4
Try to trick the browsers by setting bogus Mime-Type. If it doesn't
recognize the Mime-Type, it might produce the dialog you want to ask the
user for further instructions. Unless it decides based on the file
extension...

Eliyahu
"Patrick" <qu*******@newsgroup.nospam> wrote in message
news:8A**********************************@microsof t.com...
I think you misunderstood. I do NOT want JavaScript popups, but rather the default Internet Explorer pop-up.

? Some files can harm your computer. If the file information below looks
suspicious, or you do not fully trust the source, do not open or save this
file.
Filename: datagrid.xls
Filetype: Application
From: localhost

Would you like to open the file or save it to the computer?
[Open] [Save] [Cancel] [More Info]

How can I generate the Response so the user get prompted to save or open the DataGrid as an Excel file instead of opening in the current window by default?
"Eliyahu Goldin" wrote:
I didn't look into the example.

Generally, to produce a popup request you would need to handle client-side
onclick event in the way:

onclick="return confirm("Do you want to save file?")";

This will open a popup with the question and buttons "Ok" and "Cancel". If you want another buttons, like "Save" and "Open", you need to make your own html dialog that will return different values depending on selection.

You can set client-side onclick handler in the code with Attributes
collection.

Eliyahu

"Patrick" <qu*******@newsgroup.nospam> wrote in message
news:F5**********************************@microsof t.com...
Following on from the excellent example at

http://www.c-sharpcorner.com/Code/20...ridToExcel.asp
on how to save a data-grid to excel file, how can I extend the example

such
that when the user click on the button a popup appear in IE to say "Do you want to save or open file?"


Nov 19 '05 #5
Hi Patrick,

I think the kb article Patrice provided may help you do it. Also, in
ASP.NET we can just apply this as below in our page's c ode:

private void Page_Load(object sender, System.EventArgs e)
{
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "Application/zip";
Response.AddHeader( "Content-Disposition",
"attachment;filename=mypackage.zipl");

Response.WriteFile(Server.MapPath("~/files/myzip.zip"));

Response.End();
}

Also, you can search for many threads or articles on web discussing the
same question. Hope helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #6

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

Similar topics

0
by: a | last post by:
Save text file as html kloepper 17:42 23 Jul '04 I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html...
5
by: kevin | last post by:
Hi, Any help with this would be really appreciated! I'm trying to download a file from a remote server. The access permissions is okay but the problem I'm facing is that the file is getting...
4
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. ...
4
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...
10
by: GJP | last post by:
Hello. Ive been asked to make my own notepade for college assignment. All ig going well, but i cant get the save to work. I can get Save a (shows dialog box), i can get it to just save too,...
10
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got...
1
by: liuliuliu | last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a pygame display? i have a surface which is basically the entire visible screen -- how do you write this surface as an image...
3
by: fiefie.niles | last post by:
I would like to save a web page to a file and have the hyperlinks work when I bring the file back up. If the web page has a hyperlink like the following <a href="OurWeb/News/abcFile.htm">, after...
3
by: =?Utf-8?B?YXNkZg==?= | last post by:
Hello. I am making a web application with c# and am using this code: Response.ContentType = "application/x-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=" +...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.