943,769 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 3858
  • ASP.NET RSS
Aug 31st, 2009
0

<a href> dynamically in ASP.NET

Expand Post »
hi to all,
I want to give user facility to download files from my website.
so, user first view it. I saved file path in data table, but I don't know how to change href value dynamically..?

or any other solution exist?
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
sakhi kul is offline Offline
62 posts
since Aug 2009
Aug 31st, 2009
0

Re: <a href> dynamically in ASP.NET

If you have the path + name of the file . maybe try the following.

add the path and name to a datatable.

From there you need to get the selected index of the grid row.

Then you get the datarow and the clumns of the row [file path] [file name] and assign it to the item you need ... then on click , response.redirect .
cVz
Reputation Points: 29
Solved Threads: 7
Junior Poster
cVz is offline Offline
139 posts
since Mar 2008
Sep 1st, 2009
0

Re: <a href> dynamically in ASP.NET

Declare an <a> object in the HTML markup as below. See the runat="server" property. So that you can set/get the properties of <a> object from the C# code behind class file.

ASP.NET Syntax (Toggle Plain Text)
  1. <a id="anchDownloadFile" runat="server">Download</a>

You can assign href in the C# class file as below

ASP.NET Syntax (Toggle Plain Text)
  1. anchDownloadFile.HRef = "http://localhost/yoursitename/fileName";
Last edited by Ramesh S; Sep 1st, 2009 at 8:20 am.
Reputation Points: 165
Solved Threads: 113
Posting Pro
Ramesh S is offline Offline
580 posts
since Jun 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Web Service
Next Thread in ASP.NET Forum Timeline: Urgent Answer Needed





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC