So I've created some content nodes that have one RTE datatype called 'content', these nodes are going to be treated as reusable widgets so I'd like users to be able to pick the nodes from a content picker(macro) and then the data in the RTE will be output on the front-end. The macro will be mainly used in the grid editor, the picker works I'm just having trouble outputting content from the picked node.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
@*get the picked node from the content picker*@
var node = Umbraco.Content(CurrentPage.picker);
@*output the data stored in the 'content' datatype*@
@node.content;
}
Gives this error where the content would be rendered :-
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The call is ambiguous between the following methods or properties: 'Umbraco.Web.UmbracoHelper.Content(params int[])' and 'Umbraco.Web.UmbracoHelper.Content(params string[])'
at CallSite.Target(Closure , CallSite , UmbracoHelper , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at ASP._Page_Views_MacroPartials_widgetRender_cshtml.Execute() in c:\DignityFiles\Simplicity\Simplicity\Views\MacroPartials\widgetRender.cshtml:line 6
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
at Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult)
at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, IPublishedContent content)
at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, INode node)
at umbraco.macro.LoadPartialViewMacro(MacroModel macro)
at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(macro m, IDictionary`2 parameters, page umbracoPage)
at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(String alias, IDictionary`2 parameters, page umbracoPage)
at Umbraco.Web.UmbracoComponentRenderer.RenderMacro(String alias, IDictionary`2 parameters)
at Umbraco.Web.UmbracoHelper.RenderMacro(String alias, IDictionary`2 parameters)
at ASP._Page_Views_Partials_grid_editors_macro_cshtml.Execute() in c:\DignityFiles\Simplicity\Simplicity\Views\Partials\Grid\Editors\Macro.cshtml:line 15
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model)
at ASP._Page_Views_Partials_grid_editors_base_cshtml.Execute() in c:\DignityFiles\Simplicity\Simplicity\Views\Partials\Grid\Editors\Base.cshtml:line 20
first time using macro's in Umbraco, any pointers would be appreciated. Maybe theres a better way of doing this outside of macros?
Output data from a content picker via a macro
So I've created some content nodes that have one RTE datatype called 'content', these nodes are going to be treated as reusable widgets so I'd like users to be able to pick the nodes from a content picker(macro) and then the data in the RTE will be output on the front-end. The macro will be mainly used in the grid editor, the picker works I'm just having trouble outputting content from the picked node.
Gives this error where the content would be rendered :-
first time using macro's in Umbraco, any pointers would be appreciated. Maybe theres a better way of doing this outside of macros?
Regards, M
Hi M,
You have to specify type of input parameter, try this one:
Thanks,
Alex
Even better will be like that:
Thanks,
Alex
CurrentPage.picker is html?
Working solution.
Great, glad that you found solution!!!
is working on a reply...