Copied to clipboard

Flag this post as spam?

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


  • Rizwan 28 posts 138 karma points
    Jun 13, 2021 @ 06:37
    Rizwan
    0

    Multinode tree view picker

    Dear Experts,

    I have added multinode tree view picker property on my home page and configure content and item type. i am getting null values even i can see the count

    @foreach (var item in homePage.FeaturedProducts){var media = item.Value<IPublishedContent>("image"); error null value }
    

    i can see the values in item variable on debug mode.

    please advice

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Jun 13, 2021 @ 07:25
    Marc Goodson
    101

    Hi Rizwan

    Is the 'image' property on the picked nodes present on each picked FeaturedProduct?

    eg does:

    @foreach (var item in homePage.FeaturedProducts){
    <li>@item.Name</li>
    
     }
    

    successfully give you a list of each picked item or error in a similar way?

    If it does write out the names then does:

    @foreach (var item in homePage.FeaturedProducts){
    if (item.HasValue("image")) {
    var media = item.Value<IPublishedContent>("image");
    }}
    

    make a difference?

    and finally which version of the Media Picker are you using for the 'image' property?

    The new V3 version released in 8.14 has a different syntax for accessing the property (https://our.umbraco.com/documentation.../Fundamentals/Backoffice/Property-Editors/Built-in-Property-Editors/Media-Picker-3/):

    @foreach (var item in homePage.FeaturedProducts){
    if (item.HasValue("image")) {
    var v3PickedMedia = item.Value<MediaWithCrops>("media");
    // you access the IPublishedContent item via a new MediaItem property
    var media = v3PickedMedia.MediaItem;
    }}
    

    Other than that other thing might be your Internal Examine index, it may be worth rebuilding that from the developer section, and 'nucache caches' too just to rule ot anything weird.

    Anyway hope that helps!

    regards

    Marc

  • Rizwan 28 posts 138 karma points
    Jun 13, 2021 @ 08:10
    Rizwan
    0

    Dear Marc,

    Thanks for solution, you are correct i am using version 8.14 and media picker3.

    Thanks again

Please Sign in or register to post replies

Write your reply to:

Draft