Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've got a helper method (installed as part of uBlogsy) which takes a List<> of nodes, cycles through the list and does some stuff...
@helper renderNodes(List<umbraco.NodeFactory.Node> nodes)
//Does some stuff here...not included for ease of reading
Currently I build a list of nodes up (gained from the Alias and pass this to the helper) but I need to change my functionality.
Basically I now have to build the list from a set number of node ID that are stored in a DB, so I'm declaring a 'node' list.
var myNodeList = new List<umbraco.NodeFactory.Node>();
And I'm trying to add to this list a node that I've gotten via it's ID but I can't see a helper in umbraco.NodeFactory.Node that allows me to do this and trying Umbraco.Content(####) allows me to get the Node but I can't add it to the list.
Can anybody shed some light or help please?!?
Umbraco Node and Umbraco.Content are different entities, you can't use both in one List, because List is a list of objects the same type.
Try to use Umbraco.Content(####) for all items or event better -
I'm not sure how to define and pass these items as a list.
Craig, you can pass a list of node ids to Umbraco.TypedContent() and Umbraco.Content() and have a list of IPublishedContent what is a new way of working with Nodes in Umbraco.
Node is deprecated, what version of Umbraco are you using?
I;m using 7.2.5
You can use:
I would recommend using the newer IPublishedContent as opposed to NodeFactory.
var myNodeList = new List<IPublishedContent>();
var someNode = Umbraco.TypedContent(1234);
Thanks, Craig, that's the same what I meant.
Got it, cheers buddy
Glad that you solved the issue!
Have a nice day!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted