Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
hi to all...
 
I m in a requirement to meet that to download a file from a site. The file is in a folder and file name is in database column. If the user clicks on the name of the File, then that should get download.
 
thanks..
Posted 21-Jun-11 4:10am
Comments
digital man at 21-Jun-11 9:17am
   
What have you tried already?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can take the help from following link
 
Click here
 
Change thehyperlink to your linkbutton and onclick event write the code of downloading.aspx
  Permalink  
Comments
Marcus Kramer at 21-Jun-11 9:45am
   
Your answer is correct, so I won't give you a 1, but a 2 because this is clearly homework and you are not helping the OP by simply linking him to a complete source code listing. The OP will learn nothing from this and you are in fact just facilitating them in not learning anything.
Brij at 21-Jun-11 9:54am
   
I don't agree with your comments. One cannot force somebody to learn and its just his/her choice to learn.
What you expect the answer? When the Internet flooded with similar kind of question and Answer. Why to write one again. OP should've find it him/herself.
Might be due to some problem, s/he could not find/map the exact answer, So I provided.
If you have sourcecode, you can learn easily if want and if not, nobody can make you to start learn
charles henington at 21-Jun-11 10:26am
   
Brij You get my 5 and Marcus I disagree seeing how a code is structured, written and a visual representation of how a certain outcome was achieved is a great way to learn. All Programmers (Even Yourself) can not say that they have never learned anything from a complete tip/trick or tutorial, which is exactly what you have stated above. When learning programming a visual representation in my opinion is the easiest way to understand and learn from. That being said i think you owe a reconsideration on your vote of 2.
Brij at 21-Jun-11 10:31am
   
Thanks Charles!! You are absolutely correct.
charles henington at 21-Jun-11 10:45am
   
I have a question for you as you seem to be quite the expert in asp.net. I program in WinForms and I'm currently designing a webBrowser and have googled a great bit on how to get the link of the Element that currently has focus. Do you have any idea how i might be able to go about doing so?
Brij at 21-Jun-11 10:50am
   
You can get it by document.activeElement in your java script code
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

link_button Click event
            {
                Response.BufferOutput = true;
                Response.Buffer = true;
                Response.AddHeader("Content-Disposition", "attachment;filename= " + SELECT FileName.ToString());
                Response.BinaryWrite((byte[])SELECT FILEBODY);
                Response.Flush();
                Response.End();
            }
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 277
1 DamithSL 225
2 Maciej Los 210
3 Richard MacCutchan 178
4 BillWoodruff 155
0 OriginalGriff 5,130
1 DamithSL 4,197
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 21 Jun 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100