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.
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?
Add to and pass List<> of nodes
Hi Folks,
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...
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.
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?!?
Thanks, C
Hi Craig
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 - Umbraco.TypedContent(####)
Thanks,
Alex
Hi Alex,
I'm not sure how to define and pass these items as a list.
Thanks
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:
Hi Craig,
I would recommend using the newer IPublishedContent as opposed to NodeFactory.
Regards
Craig
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...