How to get all node of specific type using Node factory?
How to get all node of specific type using Node factory?
Hi I am little new to use node factory class. I want to know is there any way to fetch nodes on bases of their type and order them on basis of their property.
I am coding in C# and looking for something like…
Nodes MyNodes = new Nodes(); MyNodes = NodeFactory.GetAllNodes(‘Events’).Orderby(“EventEndDate”)
I am fine without linq. just give me some code snipet that works fine for above. I just want to loop through nodes of certain types. i would do ordering manually.
i have certain code for this tasks (found from forum only) but not working.
umbraco.presentation.nodeFactory.Node node = new umbraco.presentation.nodeFactory.Node(1158); umbraco.presentation.nodeFactory.Nodes childrenNodes = node.Children;
How to get all node of specific type using Node factory?
How to get all node of specific type using Node factory?
Hi I am little new to use node factory class. I want to know is there any way to fetch nodes on bases of their type and order them on basis of their property.
I am coding in C# and looking for something like…
Nodes MyNodes = new Nodes();
MyNodes = NodeFactory.GetAllNodes(‘Events’).Orderby(“EventEndDate”)
Please help me in this.
Regards
Jigar
Hi,
Me thinks you're really into linq... might have to wait for linq2umbraco to make such calls :p
Anyways, you could also use some smart xslt to get the same results:
-Build an xslt file that does the filtering and the sorting of the nodes
-Transform the cached xml content against the xslt using the .net api's such as the XslCompiledTransform class.
Hope this helps.
Regards,
/Dirk
All right Dirk De Grave,
I am fine without linq. just give me some code snipet that works fine for above. I just want to loop through nodes of certain types. i would do ordering manually.
i have certain code for this tasks (found from forum only) but not working.
umbraco.presentation.nodeFactory.Node node = new umbraco.presentation.nodeFactory.Node(1158);
umbraco.presentation.nodeFactory.Nodes childrenNodes = node.Children;
this gives error to me.
Any help would be appriciated.
Regards,
Jigar
Does this help:
http://our.umbraco.org/forum/developers/api-questions/2763-List-all-child-nodes-using-API?sort=oldest
I've just added a howto article in the wiki that may help.
when using those extension methods you can write the following: (not tested)
Hope that helps.
Or you can use ChildrenAsTable (which then can be sorted or filtered)
Maybe it loads all childs in single query and may be faster.
Petr
is working on a reply...