Copied to clipboard

Flag this post as spam?

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


  • Jamie Attwood 201 posts 493 karma points c-trib
    Aug 29, 2016 @ 16:50
    Jamie Attwood
    0

    Updating values inside DynamicPublishedContentList

    I have an DynamicPublishedContentList that is returning among other things the node id of a related content node.

    I need to filter this result set based on a value inside a property contained in the related node. While not ideal, I would like to iterate through the DynamicPublishedContentList and either create a temp value containing this related property value so that I can then bind my UI output to this updated DynamicPublishedContentList and sort by the value of the related property value. Is this possible? If not, can anyone provide any suggestions on a better approach?

    Something like this...

            var baseSelection = startNode.Descendants(documentTypeAlias)
            var tempSelection = new DynamicPublishedContentList(selection);
                 foreach (var tempItem in selection)
                  {
                     //now resolve related content id to a node and retrieve its property value and assign to a new value in the collection OR update existing value
     tempItem.Add("testproperty", "test");
                  }
    

    Thanks in advance!

    Jamie

  • Alex Skrypnyk 6131 posts 23950 karma points MVP 7x admin c-trib
    Sep 01, 2016 @ 12:35
    Alex Skrypnyk
    0

    Hi Jamie,

    Can you use strongly typed models? If you avoid using dynamics - you will be able to make filtering really easy.

    Thanks,

    Alex

  • Jamie Attwood 201 posts 493 karma points c-trib
    Sep 01, 2016 @ 16:37
    Jamie Attwood
    0

    Thanks Alex - I created another post that more accurately describes the scenario. If you can take a look that would be great - any sample linq code would be greatly appreciated.

    https://our.umbraco.org/forum/templates-partial-views-and-macros/79665-using-nupicker-value-inside-orderby-clause

    Cheers,

    Jamie

Please Sign in or register to post replies

Write your reply to:

Draft