More in this section

Forums / Developing with Sitefinity / Set downloadlist library in code

Set downloadlist library in code

2 posts, 0 answered
  1. Mark
    Mark avatar
    7 posts
    16 Mar 2009
    03 Jun 2009
    Link to this post
    I'm trying to use a your downloadlist control and I'm not seeing exactly where you would set a particular library for it to use.  By default, it's displaying all libraries.  I need to set this in the code behind.  How do you do this?

  2. Dido
    Dido avatar
    149 posts
    24 Sep 2012
    05 Jun 2009
    Link to this post
    Hi Mark,

    You can set it's FilterExpression with code that looks something like this:

    LibraryManager manager = new LibraryManager(); 
    IList libraries = manager.GetAllLibraries(); 
    List<Guid> parentIds = new List<Guid>() { /* get ids of libs you want to have filter  for */}; 
    ContentFilterBuilder filterBuilder = new ContentFilterBuilder(downloadList); 
    if (parentIds.Count > 0) 
       string leftOperand = "ParentID"
       string rightOperand = filterBuilder.GenerateCommaDelimitedString<Guid>(parentIds); 
       ContentFilter.Condition condition = ContentFilter.Condition.In; 
       ContentFilter.JoinType join = ContentFilter.JoinType.And; 
       ContentFilterStatement statement = 
          new ContentFilterStatement(leftOperand, rightOperand, condition, join); 
          new ContentFilterStatement( 

    Best wishes,
    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