Copied to clipboard

Flag this post as spam?

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


  • Samuel Caron 1 post 71 karma points
    Jun 20, 2019 @ 01:27
    Samuel Caron
    0

    How to use recursive with Umbraco v8?

    Hello, I was wondering if it was still possible to use recursive?

    In umbraco 7 it was Model.Content.GetPropertyValue< string >("PropertyName", true)

    What is it in Umbraco v8?

    Thank you.

  • Marc Goodson 1451 posts 9716 karma points MVP 5x c-trib
    Jun 23, 2019 @ 09:39
    Marc Goodson
    3

    Hi Samuel

    Yes this is still possible in V8, the syntax is a little different though, you now specify a Fallback option, for how the value should 'fall back' if it is null:

    So in your example

    Model.Content.GetPropertyValue<string>("PropertyName", true)
    

    would become

    Model.Value<string>("PropertyName", fallback: Fallback.ToAncestors)
    

    See a list of options in the documentation here for fallbacks:

    https://our.umbraco.com/Documentation/Reference/Querying/IPublishedContent/Properties#fallbacks

    regards

    Marc

  • 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