How do I open a pdf document stored in Sitecore when a user clicks a link? The pdf document is stored in the Media Library.
Here’s the code I have now:
Sitecore.Data.Fields.LinkField linkField = item.Fields["Url"];
tab.NavigateUrl = linkField.Url;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Same rules apply to a PDF media as to any other type in media library. If you need just to retrieve the media url to construct a link, do the following:
You can also simply use web control or xsl control to render the link:
Web control:
If your question concerns browser behavior when the link is clicked, set ForceDownload to true: