Copied to clipboard

Flag this post as spam?

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


  • Adam Bird 1 post 71 karma points
    May 16, 2018 @ 08:10
    Adam Bird
    0

    Repeatable Textstrings inside Mulitnode content picker

    I am a newbie to Umbraco and have been finding my feet with a million bits of assistance already from the reading the forum, but have been unable to find the answer to an issue which I've been fighting with over a couple of days.

    I have a Multinode Content Picker, which is looping through a series of various document types.

    I can pull out single text boxes and textareas without issue, but cannot pull out a list of repeated text strings as whichever way I try it I keep getting an Object reference not set to an instance of an object error. Assuming that the fix is a straight-forward one, but cannot see the wood from the trees:

    Code Sample - embedURL works fine, bulletedListItem, not so much.

        @inherits Umbraco.Web.Macros.PartialViewMacroPage@{
    var typedMultiNodeTreePicker = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("contentBlockBuilder");
    
        foreach (var item in typedMultiNodeTreePicker){
            var embedURL = item.GetPropertyValue("embedURL");
    
            if(embedURL != null){
                @Html.Raw(embedURL)
            }
    
            if (item.GetPropertyValue<string[]>("bulletedListItem").Length > 0)
            {
                foreach (var bullet in item.GetPropertyValue<string[]>("bulletedListItem"))
                {
                    <p>@bullet</p>
                }
            }
    
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft