Trying to attempt to display content in a partial view though the use of the Multi-NodTree Picker (Alias homePreviewColumns)
Issue lies in NodeById is inherted through
umbraco.MacroEngines.DynamicNodeContext and as I'm in MVC mode I need to
inherit from Umbraco.Web.Mvc.UmbracoTemplatePage. Please correct me if I'm
wrong?
Does anyone know of a work around?
@using umbraco.MacroEngines
@using umbraco;
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
if (CurrentPage.HasProperty("homePreviewColumns"))
{
int[] nodeList = uQuery.GetXmlIds(CurrentPage.homePreviewColumns.ToXml());
foreach (int preview in nodeList)
{
var node = Model.NodeById(preview);
<p>@node.name</p>
}
}
}
My solution was to create an instance of DynamicNode but could of used umbraco.NoteFactory
@{
int[] nodeList = uQuery.GetXmlIds(CurrentPage.homePreviewColumns.ToXml());
foreach (int preview in nodeList)
{
var node = new DynamicNode(preview);
//var node = new umbraco.NodeFactory.Node(preview); Alternative
@node.GetProperty("pageTitle").Value
@node.GetPropertyValue("pageContent")}
Multi-Node Tree Picker in Partial View
Trying to attempt to display content in a partial view though the use of the Multi-NodTree Picker (Alias homePreviewColumns)
Issue lies in NodeById is inherted through umbraco.MacroEngines.DynamicNodeContext and as I'm in MVC mode I need to inherit from Umbraco.Web.Mvc.UmbracoTemplatePage. Please correct me if I'm wrong?
Does anyone know of a work around?
Solved!
My solution was to create an instance of DynamicNode but could of used umbraco.NoteFactory
I like to work with IPublishedContent so have an extension method like so (also store tree picker as csv not xml).
then you can just use it like so
Model.Content.GetContentList("homePreviewColumns")
You could also extend UmbracoHelper for a similar result.
Still need to investigate performance/details of TypedContent though and check whether the caching actually helps...
Thanks Mark!
is working on a reply...