Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bilal Haidar 144 posts 410 karma points
    Aug 23, 2016 @ 18:36
    Bilal Haidar
    0

    Render ListView Content on front-end

    Hi,

    In case I've added a property of Data Type List View - Content onto a Document Type. Then I created several content items using the ListView Content control (Create etc.).

    Is there a way to retrieve those created records and render them on the front end inside a Template?

    Thanks

  • Amir Khan 1289 posts 2746 karma points
    Aug 23, 2016 @ 19:00
    Amir Khan
    0

    Hi Bilal,

    There's lots of ways, if you go to Settings > Partial Views > Create you'll see lots of snippets you can start with depending on whether you want to list them by document type, children of a start node, etc.

    Quick example below to list them with a start node and limit the query by document type.

    Hope this helps!

    Amir

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    @{
    var startNode = Umbraco.Content(1234); var selection = startNode.Descendants("YourDocTypeHere").Where("Visible"); }

    @if (selection.Any()) {

    foreach (var node in selection) {

    @node.Name

    }

    }

  • Bilal Haidar 144 posts 410 karma points
    Aug 24, 2016 @ 08:11
    Bilal Haidar
    0

    Thanks Amir. Maybe I didn't explain myself clear. I wanted to render the List View Content Grid as is on the front end.

    Thanks

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies