|
|
 |
BOOK: Beginning ASP.NET 2.0 and Databases  | This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 and Databases by John Kauffman, Bradley Millington; ISBN: 9780471781349 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 2.0 and Databases section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

March 23rd, 2009, 04:15 AM
|
|
Authorized User
|
|
Join Date: Mar 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
messagebox on file download
I am new to ASP.net and I am designing the website is ASP.NET c#
My query:
I would like to get the pop up message box after clicking on the hyperlink while downloading the file that shows whether the file should be opened, saved or cancelled and the file size, duration for file download etc.
Pl. let me know the answer of this bit fast.
Thanking you in advance.
Apurva
|

March 23rd, 2009, 03:42 PM
|
|
Wrox Author
Points: 12,827, Level: 49 |
|
|
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,029
Thanks: 1
Thanked 42 Times in 42 Posts
|
|
The implementation will vary but the process is the same: use a JavaScript confirmation box.
So you might do something like this:
javascript Code:
function GoToDownload() { if(confirm('Do you want to download this file?')) { document.location = 'file.exe'; return true; } else return false; }
then the html:
<a href='#' onClick="return GoToDownload();">Download File</a>
If i were doing this in a Server control like a button I would probably do something like:
btn.Attributes.Add("onClick", "return confirm('Do you want to download this file?')");
So then when the user clicks on my button they will see the confirmation box and if they click OK the buttons Serverside event is triggered otherwise nothing happens.
hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click  on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
|

March 23rd, 2009, 06:01 PM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Location: OKC, OK, USA.
Posts: 211
Thanks: 1
Thanked 7 Times in 7 Posts
|
|
messagebox on file download
hmmmm......dparsons, I thought apurva was wanting to duplicate the small page that pops up when a customer request, by clicking the download hyperlink. Did I not interpret that correctly?
peace95
__________________
Disclaimer: The above comments are solely the opinion of one person and not to be construed as a directive or an incentive to commit fraudulent acts.
|

March 23rd, 2009, 08:19 PM
|
|
Wrox Author
Points: 12,827, Level: 49 |
|
|
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,029
Thanks: 1
Thanked 42 Times in 42 Posts
|
|
Ahhh, my mistake. Thats what i get for reading over a post to quickly! After carefully re-reading I assume you are probably linking to a file that the browser understand (pdf, jpg, xls, etc) and, instead of downloading the file, it is opening it directly. Am I right? If this is the case you will need to write a bit of custom code:
csharp Code:
Response.ContentType = "image/jpeg"; Response.AppendHeader("Content-Disposition","attachment; filename=somejpeg.jpg"); Response.TransmitFile( Server.MapPath("~/somejpeg.jpg") ); Response.End();
You will obviously need to modify this for your purposes but take care to modify the ContentType property so that it matches the type of file you are sending. You can find a fairly good list in the last post of this thread: http://www.daniweb.com/forums/thread38650.html
hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click  on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |