Copied to clipboard

Flag this post as spam?

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


  • Venkatesh Kadiyala 2 posts 72 karma points
    Dec 27, 2018 @ 17:22
    Venkatesh Kadiyala
    0

    How to add/merge two DynamicPublishedContentList ?

    Hi, I am new Umbraco and I was trying something but couldn't able to figure it out. Can anyone please have a light on it ?

    I have created two nodes (1193,1311) which allows users to upload videos. One set of users don't see the other node videos. But however for displaying videos on the front end page, I would like to merge the two nodes with their content and iterate on the list and display them. How do I merge two nodes ? Here is the code I am trying..

    <div class="vcoLibrary">
    
               @{
            var node = Umbraco.Content(1193).Children;    
            var node1 = Umbraco.Content(1311).Children; 
            foreach(var vco in node){
            <div style="display:inline-block">
                      <a href="@vco.Url" class="vcoLink"> 
                      <div class="vco">
                        <img src="@vco.PosterImage" alt="@vco.VideoTitle" />
                        <div class="detailsWrapper">
                          <div class="vcoDetails">
                            <div class="vcoTitle">@vco.VideoTitle</div>
                            <div class="vcoStudio">@vco.Studio</div>
                            <div class="vcoDate">@vco.ReleaseDate.ToString("MM/dd/yyyy")</div>
                          </div>
                        </div>
                       </div></a><!--
                        -->
               </div>
              }
            }
              </div><!-- videoLibrary -->
    }
    
  • Marc Goodson 887 posts 5808 karma points MVP 4x c-trib
    Dec 28, 2018 @ 00:51
    Marc Goodson
    0

    Hi Venkatesh

    Would

    var combinedList = node.Concat(node1);
    

    do the trick?

    regards

    Marc

  • Venkatesh Kadiyala 2 posts 72 karma points
    Dec 28, 2018 @ 17:52
    Venkatesh Kadiyala
    0

    Hi Marc,

    Here node is DynamicPublishedContentList and there is no Concat() for that object.

  • Marc Goodson 887 posts 5808 karma points MVP 4x c-trib
    Dec 29, 2018 @ 00:44
    Marc Goodson
    0

    Hi Ventkatesh

    Yes, but DynamicPublishedContentList implements IEnumerable<DynamicPublishedContent>

    So as long as you reference the System.Linq namespace, you should be able to use the Concat extension method...

    @using System.Linq;

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft