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

Forums / Developing with Sitefinity / Display Video/Image library as a folder structure

Display Video/Image library as a folder structure

8 posts, 0 answered
  1. Wessam
    Wessam avatar
    14 posts
    Registered:
    04 Jan 2007
    31 May 2009
    Link to this post
    Hello,
    Is there a way to display the categories of the Video/Image libraries in a folder format. Categories would be displayed as folders, when you click on a folder, it will display categories and videos/images beneath it.

    Thanks.
  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    01 Jun 2009
    Link to this post
    Hi Wessam,

    yes this is possible. Namely, in Sitefinity 3.6 we have released Categories Tree control, which is based on RadTreeView control. You can style the control to have little folder icons, like in this sample (http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/contextmenu/defaultcs.aspx). Apart from styling, the Categories Tree control will display filter the ContentView (ContentView, NewsView, EventsView, BlogPosts, Image Gallery) based control out of the box, as you would expect. Just make sure that the CategoryKeyId properties on both controls (e.g. Category Tree and Image Gallery) match - like "ImageCat". The CategoryKeyId basically connects two controls (because, in theory, you could have 2 Category Tree controls one for BlogPosts and one for EventsView so there has to be a way to determine which control filters which control).

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    Kind regards,
    Ivan
    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.
  3. Wessam
    Wessam avatar
    14 posts
    Registered:
    04 Jan 2007
    05 Aug 2009
    Link to this post
    Can you please show me an example on how can this be done. What I'm trying to do is to replicate the functionality on the following link
    http://www.partnershipforlebanon.org/en/Home/Resource+Center/Photos.aspx

    Categories are displayed in a folder structure, clicking on an icon displays categories and photos/videos beneath it.
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    10 Aug 2009
    Link to this post
    Hello Wessam,

    We do not have the exact controls for the specific scenario. You can use our API to get the the categories:
    Then you can use the categories together with the content items:
    What you can do is actually the following - once you get the categories, create a "folder image" with NavigateURL containing the category name in the query string. Then, in the page load event, find the ImageGallery control and set the filter expression property to
    • Category in ("YourCategory").

    This should do the trick.

    I apologize that we are not able to provide you with the complete control at the moment.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  5. Wessam
    Wessam avatar
    14 posts
    Registered:
    04 Jan 2007
    26 Aug 2009
    Link to this post
    Hi Georgi,
    Thanks for the advice. I did what you told me, but whats happening is the following. If I set the FilterExpression to a certain category, the image library displays images in that category, and images in sub categories as well. So lets say I have category called cat1, and cat1 has 2 sub categories, cat2 and cat3. If I set the filter expression to Category in ("Cat1"), the images of all the 3 categories. Is that normal behavior, or am I missing something?

    Thanks
  6. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    31 Aug 2009
    Link to this post
    Hi Wessam,

    Thank you for the follow up.

    This is in fact by design - a decision by our UX team. 

    Perhaps you can process the items coming from the filtering one more time, and exclude the ones that are having that are in cat2 and cat3?

    Greetings,
    Georgi
    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.
  7. Wessam
    Wessam avatar
    14 posts
    Registered:
    04 Jan 2007
    31 Aug 2009
    Link to this post
    So this means that I can't use the ImageGallery control, right?
    I need to write a custom usercontrol to get the behavior I want.
  8. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    02 Sep 2009
    Link to this post
    Hi Wessam,

    I was think for post filtering, like this one:

           protected override IList CreateDataSource() 
            { 
                //Filter; 
                IList myItems = base.CreateDataSource(); 
                List<IContent> FilteredItems = new List<IContent>(); 
                foreach (IContent content in myItems) 
                { 
                    if (content.GetMetaData("category") != "something"
                    { 
                        FilteredItems.Add(content); 
                    } 
                } 
                return FilteredItems; 
            } 
     

    This is an overridden method of the Image Gallery control. You can create a custom control and inherit from ImageGallery. 

    Sincerely yours,
    Georgi
    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.
Register for webinar
8 posts, 0 answered