1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Download list Control Title Link

Download list Control Title Link

2 posts, 0 answered
  1. Daniel
    Daniel avatar
    62 posts
    Registered:
    20 Apr 2009
    19 Jun 2009
    Link to this post
    Hello Again Guys!

    I have a download list and if I click the title link I get some weird extensions on the end of my .doc file but if I use the download link all is ok!

    Just wondering if there is anyway of modifying the title's link or disabling it completely?

    Thanks again

    Daniel
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    24 Jun 2009
    Link to this post
    Hi Daniel,

    You can create a new custom control inheriting from the DownloadList, and modify its behavior:
    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using Telerik.News.WebControls; 
    using Telerik.News; 
    using System.Collections; 
    using Telerik.Cms.Engine; 
    using Telerik.Libraries; 
    using System.Web.UI.WebControls; 
    using Telerik.Framework.Web.Design; 
    using System.Web.UI; 
    using System.ComponentModel; 
     
    /// <summary> 
    /// Summary description for CustomNewsView 
    /// </summary> 
    namespace Telerik.Samples 
        [ToolboxItem(typeof(CustomDownloadList))] 
        public class CustomDownloadList : DownloadList 
        { 
            protected override void SetListMetadata(System.Web.UI.Control itemContainer, IContent contentItem) 
            { 
                base.SetListMetadata(itemContainer, contentItem); 
                HyperLink downloadLink = itemContainer.FindControl("DownloadLink"as HyperLink; 
                downloadLink.NavigateUrl=ResolveUrl(string.Format("{0}?download=true", contentItem.UrlWithExtension)); 
     
            } 
            public override Type LocalizationAssemblyInfo 
            { 
                get 
                { 
                    return typeof(DownloadList); 
                } 
                set 
                { 
                    base.LocalizationAssemblyInfo = value; 
                } 
            } 
            public override System.Type AssemblyInfo 
            { 
                get 
                { 
                    return typeof(DownloadList); 
                } 
                set 
                { 
                    base.AssemblyInfo = value; 
                } 
            } 
     
        } 
     

    This should do the trick. In order to use this control, please take the following steps:
    1. Create a new .cs file in the App_Code named CustomDownloadList.cs
    2. Use the code above
    3. Register the new control in the web.config file:
    <toolboxControls> 
            <clear /> 
            <add name="CDownloadList" section="New" type ="Telerik.Samples.CustomDownloadList, App_Code"/> 
    ... 

    4. Drag the CDownloadList control from the New section of the toolbox control on the page.

    Don't hesitate to contact us if you have other questions.


    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered