I tend to grab the nodes, then render using a partial named after the doc type alias passing in the node as model. Something like:
var nodes = Umbraco.TypedContent(listOfIds);
foreach(var node in nodes){
@Html.Parial("Partials\Widgets\" + node.DocumentTypeAlias, node)
}
(Note, working this way, my widgets don't have a template defined against them, I just hook them up manually)
I think Lee Kelleher knows a way to render an entire page along with it's template though if you want to go that route. I'll ping him this URL and see if he can shed any more light on the subject.
How do I render the widgets on a page?
TL;DR How do you render a content item by Node Id.
I'm using Widget Grid admin extension for Umbraco to configure a content manageable widget area and I'm stuck trying to render the configured widgets.
I have a list of node id's that I want to render on the page but I can for the life of me work out how to do this.
Any guidance is greatly appreciated, its driving me crazy, it must be easy and im missing something! Thanks.
Hi Tom,
I tend to grab the nodes, then render using a partial named after the doc type alias passing in the node as model. Something like:
(Note, working this way, my widgets don't have a template defined against them, I just hook them up manually)
I think Lee Kelleher knows a way to render an entire page along with it's template though if you want to go that route. I'll ping him this URL and see if he can shed any more light on the subject.
Hope that helps
Matt
Thanks for the reply, how do you get the list of Id's out of the Widget Grid property?
Hi Tom,
Check this thread a couple of posts down where I show a code snippet for just that:
http://our.umbraco.org/projects/backoffice-extensions/widget-grid/bugs,-feedback-and-suggestions/43856-Umbraco-6-compatibility
Many thanks
Matt
is working on a reply...