473,379 Members | 1,539 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,379 software developers and data experts.

code for downloading a file

hi, I am facing problem in download hyperlink..plz give me the
solution.
in codebehind,
private void repDocuments_ItemDataBound(object sender,
System.Web.UI.WebControls.RepeaterItemEventArgs e)
System.Web.UI.WebControls.HyperLink myLink =
(System.Web.UI.WebControls.HyperLink)repDocuments. Items[i].FindControl("LnkDownLoad");
and in aspx page,
<TD align="left" valign="top" class="GridCell"><a id="LnkDownLoad"
href='../PropertyDocuments/<%#DataBinder.Eval(Container,
"DataItem.PhysicalFileName")%>' class="recordLink LnkAppear">
Download</a></TD>
....now when i click on hyperlink 'download', i see the the file in
browser window but i want the download dialog , how can i do that??
thx
Oct 6 '08 #1
1 1121
On Oct 6, 12:36*pm, CreativeMind <aftab.pu...@gmail.comwrote:
hi, I am facing problem in download hyperlink..plz give me the
solution.
in codebehind,
*private void repDocuments_ItemDataBound(object sender,
System.Web.UI.WebControls.RepeaterItemEventArgs e)
*System.Web.UI.WebControls.HyperLink myLink =
(System.Web.UI.WebControls.HyperLink)repDocuments. Items[i].FindControl("Lnk DownLoad");
and in aspx page,
<TD align="left" valign="top" class="GridCell"><a id="LnkDownLoad"
href='../PropertyDocuments/<%#DataBinder.Eval(Container,
"DataItem.PhysicalFileName")%>' class="recordLink LnkAppear">
Download</a></TD>
...now when i click on hyperlink 'download', i see the the file in
browser window but i want the download dialog , how can i do that??
thx
If you want to have the "Save File As" dialog to be presented to the
client, instead of pointing to the file you have to create a new page
which would send a content of the file to the browser with a flag to
force download

Response.AddHeader("Content-Disposition", "attachment;.....

You can find a lot of tutorials for this, for example,
http://www.aspnetmime.com/tutorials/...ToBrowser.aspx

Another option is to open the link in the new window, using
target=_blank...
Oct 6 '08 #2

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

Similar topics

1
by: ASP Spam Fighter | last post by:
Hello all, I don't know how to get around this one... If anybody can help me with this problem, I would appreciate it very much. I've been trying to send a (large) file to the browser via a...
53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
0
by: Amol Guttal via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Amol Guttal Hi, This is the code which used to download a file from webserver. If I point a file in my localhost for download...
5
by: fniles | last post by:
We created an ActiveX control and marked it as safe for scripting using Implements IObjectSafety. We then created a CAB file and signed it using Verisign. We also created a license file (LPK file)...
0
by: just.starting | last post by:
I am having problem while downloading files from an apache server2.0.53 with php4.3.10.While downloading some files it generally stops after downloading some specific amount and then stops...
1
by: DBC User | last post by:
Hello, I would like to copy a very large file (80MB) from the web, which is the best approach for downloading such a large file and also how can I show how much percent completed to user. I...
8
by: danish | last post by:
Hi, Can anyone suggest me why some .php files are downloading and some are executing. Ive got php 5.2.0 and apache 2.0.54. Apache came as an rpm along with Fedora 4. I downloaded php from the site...
6
by: cyusman | last post by:
Hi, We have just moved our application to a new webfarm server environment which utilizing hardware load balancing, SSL off-loading and HTTP compression off-loading.My application is running on...
2
archulu
by: archulu | last post by:
hai this is archulu, i have a some confusion and doubt in my downloading program.that doubt was in my program i am upload some gif and img file to some path.it's good, after usage of that image i...
1
by: Muddasir | last post by:
Hello everyone. I am facing problem in downloading .xls file. I generate report and save data in excel sheet on server. and once user click the 'save data in excel format', an excel sheet is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.