p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 23rd, 2009, 04:15 AM
Authorized User
Points: 60, Level: 1
Points: 60, Level: 1 Points: 60, Level: 1 Points: 60, Level: 1
Activity: 5%
Activity: 5% Activity: 5% Activity: 5%
 
Join Date: Mar 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old March 23rd, 2009, 03:42 PM
Wrox Author
Points: 12,827, Level: 49
Points: 12,827, Level: 49 Points: 12,827, Level: 49 Points: 12,827, Level: 49
Activity: 15%
Activity: 15% Activity: 15% Activity: 15%
 
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,029
Thanks: 1
Thanked 42 Times in 42 Posts
Send a message via AIM to dparsons
Default

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."
===============================================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old March 23rd, 2009, 06:01 PM
Friend of Wrox
Points: 741, Level: 10
Points: 741, Level: 10 Points: 741, Level: 10 Points: 741, Level: 10
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: May 2005
Location: OKC, OK, USA.
Posts: 211
Thanks: 1
Thanked 7 Times in 7 Posts
Default 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old March 23rd, 2009, 08:19 PM
Wrox Author
Points: 12,827, Level: 49
Points: 12,827, Level: 49 Points: 12,827, Level: 49 Points: 12,827, Level: 49
Activity: 15%
Activity: 15% Activity: 15% Activity: 15%
 
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,029
Thanks: 1
Thanked 42 Times in 42 Posts
Send a message via AIM to dparsons
Default

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."
===============================================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
File Download. rupen ASP.NET 1.x and 2.0 Application Design 4 February 23rd, 2008 08:43 AM
Download File Muhammad Zeeshan ASP.NET 2.0 Professional 0 October 24th, 2007 01:51 AM
Detecting a file download johnnycorpse Classic ASP Basics 1 February 10th, 2007 04:17 PM
Smaller download/single download file available jminatel BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 November 21st, 2005 11:10 AM
Force A File To Download harpua Classic ASP Basics 6 July 26th, 2004 02:06 PM



All times are GMT -4. The time now is 02:42 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc