| Author: Ravi Kiran.T 04 Aug 2008 | Member Level: Gold | Rating: Points: 2 |
Ex: <a href="../downloads/example1.pdf">Download From Here</a>
Here "downloads" is the remote folder where we can download from.
|
| Author: Mexi Renjith Mamman 05 Aug 2008 | Member Level: Gold | Rating: Points: 6 |
In asp.net with C# you can do it as:
You can either display it in a repeater or else you can just get the file to download from DB.
Using Repeater:
<asp:Repeater ID="repDwnldDetails" runat="server" OnItemDataBound="repDetails_ItemDataBound"> <ItemTemplate> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td> <asp:Literal ID="ltDownloadName" runat="server" ></asp:Literal></td> <td> <asp:HyperLink ID="lnkDownloadFilename" runat="server" NavigateUrl="#" Text="File" Target="_blank"> </asp:HyperLink> </td> </tr> </table> </ItemTemplate> </asp:Repeater>
Bind the repeator with needed fields: In the .cs page:
protected void repDetails_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Literal ltDwnldName = (Literal)e.Item.FindControl("ltDownloadName"); HyperLink lnkDownloadFilename = (HyperLink)e.Item.FindControl("lnkDownloadFilename"); lnkDownloadFilename.NavigateUrl = "Download/" + drvDetails["down_download_stored_filename"].ToString(); } }
The file can be downloaded like this
Without using repeator control you can place a hyperlink and call the filename as above.
|