More in this section
Forums / Designing & Styling / Display ContenBlock by category

Display ContenBlock by category

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 0 answered
  1. Christian
    Christian avatar
    5 posts
    02 Oct 2011
    28 Oct 2013
    Link to this post

    Can anyone help me, on how to display content blocks by category, using the Categories Widget. It's possible width images, docs. blogs and so on, but wath about content blocks??

    Is there another aproach ?? :-)

    Best regards
  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    31 May 2017
    31 Oct 2013
    Link to this post

    The categories widget is not working with Content Blocks. For performance reasons we have tried minimizing the amount of data being pulled in our ContentSelectors throughout Sitefintiy. Loading all the avaialble tags and categories and filtering by them woul impose slower loading of the data in general.

    If you want you could pull all content blocks filtered by specific tag/category in a custom widget programatically. For example:

    var manager = ContentManager.GetManager();
        var myBlocks = manager.GetContent().Where(contBlock => contBlock.Status == ContentLifecycleStatus.Live && contBlock.GetValue<TrackedList<Guid>>("Tags").Contains(singleGuid));

    where singleGuid is the ID of your tag to filter by. To use the above sample you'll need to add a using Telerik.Sitefinity.Model in your class, to be able to use the extension method GetValue<T>().

    In a nutshell this would allow you to bind a filtered collection of shared content blocks to any suitable control and display the actual HTML content.

    Stefani Tacheva
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Christian
    Christian avatar
    5 posts
    02 Oct 2011
    31 Oct 2013 in reply to Stefani Tacheva
    Link to this post
    Hello Stefani

    Thank's for your reply.

    In the meantime i have tried to create a module and by the categories widget sorte by dynamic content type. That approach almost work - but how do i get the widget to display content, not only in top level categories??

    Hope there is a solution for that :-)

    Second question - regarding Responsive Design :

    On  the default group of rules i have applyed a css file to modify the layout. But the css file overwrite the default css file and apply the mobile css styles on all devices.. Could you help on that matter to ???

    Look forward to your reply :-)

    Best regards Christian
3 posts, 0 answered