|
Target in Downloads
Compatibility: Sitefinity 3.7
You have created a Document Gallery with several PDF documents you want visitors to be able to download. A nice Download page has been created with a Download List. But.....
When testing this page you find out that all documents open in the same website window. OK, just change the target for the hyperlink to open in a new window! How?
In order to change the target for each download on that page, three steps have to be performed:
- Get the correct external template.
- Edit the external template.
- Map the external template to your Download List.
Get external template
To get the correct external template it is necessary that the External Templates ZIP-file is downloaded. Have a look at this article to learn where to find this ZIP-file. Select the two files listed below.
~\Sitefinity\ControlTemplates\Libraries\DownloadList.ascx ~\Sitefinity\ControlTemplates\Libraries\App_LocalResources\DownloadList.ascx.resx Extract them if that was not yet done and then copy them to a folder
within your website. In this article the templates are placed in a folder called UserTemplates, with subfolders for the different modules.
~\UserTemplates\Libraries\DownloadList.ascx ~\UserTemplates\Libraries\App_LocalResources\DownloadList.ascx.resx
Edit external template
From the location the files were saved to, open the DownloadList.ascx file. Find the asp:Hyperlink code for the Downloadlink.
<asp:HyperLink ID="DownloadLink" runat="server"> <asp:Literal ID="Title" runat="server"></asp:Literal> </asp:HyperLink> Add target="blank" to the code. Your code should look like this:
<asp:HyperLink ID="DownloadLink" runat="server" target="blank">
<asp:Literal ID="Title" runat="server"></asp:Literal>
</asp:HyperLink> Save the changes and upload the files to the live server if necessary.Map external template
Log in to Sitefinity and select the page which holds the Download List. Click on the Edit this page button. Click the Edit link in the top right corner of the Download List control.

Select the Advanced tab and scroll down to the TemplatePaths section. Click on this section to open. Type the correct path in the ItemListTemplatePath field.

You can also choose Select and browse to the file for the external
template. After the file has been selected (color changes), click I'm done to return to the Advanced tab.

Click I'm done once again to return to the page. Click Publish
to save your changes. Now test your page and see if all downloads open in a new window.
|