We are using and loving this package, I'm currenty trying to do something that I am not sure is possible or not, here it goes...
In a code file I am finding the descendents of a node, this node is generated from a Document Type called Event, this document type was written in uSiteBuilder. So I grab all the event Dynamic Nodes from Umbraco with standard umbraco code.
So at this point I have a list of Dynamic Nodes are all Events
So my question is, can I then map the Dynamic Nodes to my strongly typed uSiteBuilder Event class? This way I get a strongly typed list of my Events which I can use in my Razor file.
Does that make sense? I've read it back and I'm not sure event I understand what I've just written....
I think I didn't understand everything correctly. Did you use ContentHelper class and its static methods to get Events? Can you paste your code here? You should be able to accomplish getting content without standard Umbraco code (so only by using ContentHelper). For example, there is method ContentHelper.GetChildren(int parentId) which will return descedants for a given Umbraco node id. In template, you can get id as this.CurrentContent.Id.
BTW, if you have instance of Umbraco node, than you can always get instance of appropriate uSiteBuilder class if you use ContentHelper.GetByNodeId method (whose parameter should be id of that Umbraco node).
Getting page descendents
Hi all,
We are using and loving this package, I'm currenty trying to do something that I am not sure is possible or not, here it goes...
In a code file I am finding the descendents of a node, this node is generated from a Document Type called Event, this document type was written in uSiteBuilder. So I grab all the event Dynamic Nodes from Umbraco with standard umbraco code.
So at this point I have a list of Dynamic Nodes are all Events
So my question is, can I then map the Dynamic Nodes to my strongly typed uSiteBuilder Event class? This way I get a strongly typed list of my Events which I can use in my Razor file.
Does that make sense? I've read it back and I'm not sure event I understand what I've just written....
Thanks,
Steve
Hi Steve,
I think I didn't understand everything correctly. Did you use ContentHelper class and its static methods to get Events? Can you paste your code here? You should be able to accomplish getting content without standard Umbraco code (so only by using ContentHelper). For example, there is method ContentHelper.GetChildren(int parentId) which will return descedants for a given Umbraco node id. In template, you can get id as this.CurrentContent.Id.
BTW, if you have instance of Umbraco node, than you can always get instance of appropriate uSiteBuilder class if you use ContentHelper.GetByNodeId method (whose parameter should be id of that Umbraco node).
Regards,
Vladan
Hi Vladan,
That's it exactly, the ContentHelper.GetChilden was exactly what I was after, many thanks.
is working on a reply...