Copied to clipboard

Flag this post as spam?

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


  • Levente Kosa 3 posts 33 karma points
    Jul 01, 2014 @ 11:19
    Levente Kosa
    0

    Nested MultiNodeTreePicker

    Hi There,

    Anybody knows how can I use a MultiNodeTreePicker in another MultiNodeTreePicker?
    My first trying:

     

    @{
    var tabList = CurrentPage.GetPropertyValue("tabPicker").ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); var tabListCollection = Umbraco.Content(tabList); foreach (var item in tabListCollection){
    @{
    var portfolioList = item.GetPropertyValue("portfolioItempicker").ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); var portfolioListCollection = Umbraco.Content(portfolioList); foreach (var portfolioItem in portfolioList){ @portfolioItem.Name
    } }
    }
    }

    Thanks for the help,

    Levente

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 01, 2014 @ 13:10
    Jeavon Leopold
    101

    Hi Levente,

    Welcome to Our!

    I think you have only a few minor issues with having an @{ already inside the code block and that your second loop was iterating the list not the collection.

    Try this:

    @{
        var tabList = CurrentPage.tabPickeR.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
        var tabListCollection = Umbraco.Content(tabList);
        foreach (var item in tabListCollection)
        {
            var portfolioList = item.portfolioItempicker.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            var portfolioListCollection = Umbraco.Content(portfolioList);
    
            foreach (var portfolioItem in portfolioListCollection)
            {
                @portfolioItem.Name
            }
        }
    }
    

    Jeavon

  • Levente Kosa 3 posts 33 karma points
    Jul 01, 2014 @ 13:35
    Levente Kosa
    0

    Hi Jeavon,

     Thank you for your help. Unfortunately still empty the second foreach.

    Any idea?

    Here is the full page code, maybe help a bit:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage


    <div class="tabs-container">

    <div class=container>

        <div class="row">

    <div id="tabs" class="12u">

    <ul>

                        @{

                            var tabList = CurrentPage.tabPickeR.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);

                            var tabListCollection = Umbraco.Content(tabList);

     

                            foreach (var item in tabListCollection){

       <li><a href="#@item.Id" title="">@item.Name<br/><span>@item.Description</span></a></li>       

                            }

                        }

                    </ul>

                    <div id="tabs_container">

                   @{

                            foreach (var item in tabListCollection){

       <div class="tab" id="@item.Id">

    @{

                                    var portfolioList = item.portfolioItempicker.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);

                                    var portfolioListCollection = Umbraco.Content(portfolioList);


                                    foreach (var portfolioItem in portfolioListCollection)

                                    {

                                        <h3>Name goes here: @portfolioItem.Name</h3>

                                    }

                                }

                                </div>

                            }

               }

                    </div><!--End tabs container-->

    </div><!--End tabs-->

    </div>

    </div>

     

    </div>  

     

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 01, 2014 @ 13:40
    Jeavon Leopold
    0

    There isn't anything wrong with this code specifically, I would suggest checking all of your property aliases to make sure they are exactly the same as you have in your document types including case. e.g. should "portfolioItempicker" be "portfolioItemPicker"?

  • Levente Kosa 3 posts 33 karma points
    Jul 03, 2014 @ 14:28
    Levente Kosa
    0

    Thank Jeavon,

    Empty cache is my best friend.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 04, 2014 @ 08:49
    Jeavon Leopold
    0

    Perfect! You should find that have a green tick on each of the above comments, clicking this on the correct answer will mark it as the solution.

Please Sign in or register to post replies

Write your reply to:

Draft