Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Use Hyperlink or LinkButton controls on a page to download documents from server?

Posted on 2007-11-14
7
Medium Priority
?
552 Views
Last Modified: 2012-05-05
Hi, I need to provide a page with links to download files from the server.  However, I am not sure what would be an ideal control to use for this scenario?  Would it be Hyperlink or LinkButton?  
The names of the files are never the same.  Upon clicking on the links, the code needs to get the server path from the web.config file and the filename would have to be built based on the ID of the case selected.  It is also important that the link is reusable to download the file again without having to refresh the page.

I truely appreciate your time and assistance on this.
Thank you so much!
0
Comment
Question by:LISCNY
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:McExp
ID: 20285040
Do you need to open in the same window or a new window?
0
 

Author Comment

by:LISCNY
ID: 20286684
The download dialog box should pop up when links are clicked on the page.  The users typically save the files on their local drive, but if they open the file from the dialog, it would open on a new document window.  However, the user should be able to close the opened document window and see the page with links.

Thanks for your time!
0
 
LVL 16

Expert Comment

by:McExp
ID: 20290915
Then you need a hyperlink control.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:LISCNY
ID: 20291027
Thank you.  Would you be able to refer me to a sample code?
0
 
LVL 16

Accepted Solution

by:
McExp earned 1500 total points
ID: 20293739
During the PageLoad event (of your page) you need to set the NavigateUrl of a Hyperlink control, see below for an example: -

--In your page--
<asp:HyperLink runat="server" ID="hlTheLink" Text="Open Document" />

--In your Page Load Event of the Code Behind--
string theUrl = BuildUrlFromWebConfigAndCase(CaseId);
hlTheLink.NavigateUrl = theUrl;

--Write a function to compise the URL you need--
private string BuildUrlFromWebConfigAndCase(int CaseId)
{
//Some Code
}
0
 

Author Comment

by:LISCNY
ID: 20294084
My boss just told me to do this using LinkButtons so I was able to get the desired result using LinkButtons.  Thank you for all your assistance.
0
 
LVL 16

Expert Comment

by:McExp
ID: 20299622
The only issue with the LinkButton alternative is that it requires an aditional postback to your web server to then redirect to the actual file. Whereas the Hyperlink will load the file directly.

The Hyperlink based solution is the marginally better (faster) solution.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question