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
    25 days ago
    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 743 posts 4813 karma points MVP 3x c-trib
    25 days ago
    Marc Goodson
    0

    Hi Venkatesh

    Would

    var combinedList = node.Concat(node1);
    

    do the trick?

    regards

    Marc

  • Venkatesh Kadiyala 2 posts 72 karma points
    24 days ago
    Venkatesh Kadiyala
    0

    Hi Marc,

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

  • Marc Goodson 743 posts 4813 karma points MVP 3x c-trib
    24 days ago
    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