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

Forums / Developing with Sitefinity / Problems Inheriting from DownloadList

Problems Inheriting from DownloadList

6 posts, 1 answered
  1. Trey
    Trey avatar
    7 posts
    Registered:
    16 Dec 2009
    16 Dec 2009
    Link to this post
    I am trying to extend the DownloadList control to filter its contents based on the Category assigned to each item and the current user. The presentation is exactly the same as DownloadList, and I think I've done the correct things in the code for that to happen. However, I'm not convinced that my code is even running, let alone working properly. Here is the control code, in its entirety:
    1 using System.Collections; 
    2 using System.Collections.Generic; 
    3 using Telerik.Cms.Engine; 
    4 using Telerik.Cms.Engine.ContentViewFiltering; 
    5 using Telerik.Libraries; 
    6  
    7 namespace CS2.Sitefinity.Controls 
    8
    9     /// <summary> 
    10     /// A download list that ties CMS usernames to Library categories for filtering purposes. 
    11     /// </summary> 
    12     public class ClientDownloadList : Telerik.Libraries.DownloadList 
    13     { 
    14         protected override IList CreateDataSource() 
    15         { 
    16             // Get the current username 
    17             string username = Telerik.Security.UserManager.GetCurrentUserName(); 
    18  
    19             var builder = new ContentFilterBuilder(this); 
    20             builder.AddFilter(new ContentFilterStatement("Category.Name", username, ContentFilter.Condition.Equal)); 
    21  
    22             return base.CreateDataSource(); 
    23         } 
    24  
    25         public override System.Type LocalizationAssemblyInfo 
    26         { 
    27             get 
    28             { 
    29                 return typeof(DownloadList); 
    30             } 
    31             set 
    32             { 
    33                 base.LocalizationAssemblyInfo = value; 
    34             } 
    35         } 
    36  
    37         public override System.Type AssemblyInfo 
    38         { 
    39             get 
    40             { 
    41                 return typeof(DownloadList); 
    42             } 
    43             set 
    44             { 
    45                 base.AssemblyInfo = value; 
    46             } 
    47         } 
    48     } 
    49
    50  

    I've put an entry into the web.config to register the control:

    1 <add name="Client Downloads" section="Stuff" type="CS2.Sitefinity.Controls.ClientDownloadList, CS2.Sitefinity.Controls.ClientDownloadList" description="Provides a download interface for clients." /> 
    2  

    However, when I drag and drop the control onto a page, I see exactly what I would see if I had used the standard DownloadList control. Considering that the admin user has no matching category, the list should be empty. If I've done something wrong in the code, I would expect an error to show up in the control's UI space. On top of that, no breakpoints in the code are triggered in Visual Studio. This is the biggest bit, because even if my code actually does exactly what the standard control does, the code still has to *run*, and breakpoints would fire.

    I'm about to tear my hair out at this point. I have to have done something stupid for behavior like this to happen, but I don't know what it is. Ideas?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 May 2017
    16 Dec 2009
    Link to this post
    Hello Trey,

     You need to add ToolBox item for the DownloadList control

    sample code:

    public class CustomDownloadListToolboxItem : Telerik.Web.ToolboxItem
    {
     
        public CustomDownloadListToolboxItem()
            : base(typeof(CustomDownloadList))
        {
            base.DisplayName = "DisplayName";
            base.Description = "DownloadList_Description";
        }
    }

    register the toolbox item

    [System.ComponentModel.ToolboxItem(typeof(CustomDownloadListToolboxItem))]
    public class CustomDownloadList : DownloadList
    {
     
    }

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  3. Trey
    Trey avatar
    7 posts
    Registered:
    16 Dec 2009
    16 Dec 2009
    Link to this post
    That did the trick. Thanks so much for the very quick response.

    Where could I have found that information, other than asking on here? One thing I have noticed is that developer documentation for Sitefinity is spread out across the site and in varying degrees of completion and relevance. The online developer's manual is for 3.2 SP2, the blog has a very partial manual for 3.6 (which I suspect is where my answer might have been found), and the current Sitefinity 3.7 distribution comes with none. Your product is absolutely brilliant, but the lack of coherent documentation is really hurting my efforts to get my company to adopt it. Is there an effort underway to get a handle on the documentation? When might there be results?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 May 2017
    16 Dec 2009
    Link to this post
    Hi Trey,

    You can download the chm version of the new Dev manual that explains the backend architecture from here.


    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Trey
    Trey avatar
    7 posts
    Registered:
    16 Dec 2009
    16 Dec 2009
    Link to this post
    Every page in that manual appears to be an error page:

    This program cannot display the webpage

     
     

    Most likely causes:

    • You are not connected to the Internet.
    • The website is encountering problems.
    • There might be a typing error in the address.
     

    What you can try:

     

    Check your Internet connection. Try visiting another website to make sure you are connected.

     

    Retype the address.

     

    Go back to the previous page.

     

    More information More information

    This problem can be caused by a variety of issues, including:

    • Internet connectivity has been lost.
    • The website is temporarily unavailable.
    • The Domain Name Server (DNS) is not reachable.
    • The Domain Name Server (DNS) does not have a listing for the website's domain.


  6. Burl
    Burl avatar
    8 posts
    Registered:
    12 Apr 2008
    17 Dec 2009
    Link to this post
    Hi Trey,

    On the downloaded chm file, right click and select properties, and check the Unbock file. That should be the fix.

    Burl
Register for webinar
6 posts, 1 answered