Using 7.14. I am trying to get basic information from a MNTP datatype but am getting this error when using the following code which is based on the u7 Docs. Any suggestions?
@{
if (Model.Content.HasValue("resourcespicker"))
{
var docListValue = Model.Content.GetPropertyValue<string>("resourcespicker");
var docList = docListValue.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);
var docCollection = Umbraco.TypedContent(docList).Where(x => x != null);
foreach (var item in docCollection)
{
<p>@item.Name</p>
}
}
}
Error below:
[Thread 50] Error loading partial view macro (View: ~/Views/MacroPartials/GetDocsMedia.cshtml). Exception: System.FormatException: Input string was not in a correct format.
Yes, if you have my converters installed you need to use the snippets in my documentation for those editors instead of the standard snippets in the Umbraco documentation.
Error Getting MNTP info
Using 7.14. I am trying to get basic information from a MNTP datatype but am getting this error when using the following code which is based on the u7 Docs. Any suggestions?
@{
if (Model.Content.HasValue("resourcespicker"))
{
var docListValue = Model.Content.GetPropertyValue<string>("resourcespicker");
var docList = docListValue.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);
var docCollection = Umbraco.TypedContent(docList).Where(x => x != null);
foreach (var item in docCollection)
{
<p>@item.Name</p>
}
}
}
Error below:
[Thread 50] Error loading partial view macro (View: ~/Views/MacroPartials/GetDocsMedia.cshtml). Exception: System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at ASP._Page_Views_MacroPartials_GetDocsMedia_cshtml.Execute() in c:\inetpub\dev\website.com\Views\MacroPartials\GetDocsMedia.cshtml:line 34
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 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.macro.LoadPartialViewMacro(MacroModel macro)
at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
I think I have it figured out now. I am using Jeavon's excellent Property Value converter defined here.
https://github.com/Jeavon/Umbraco-Core-Property-Value-Converters/blob/v2/Docs/MultiNodeTreePicker.md
Using his code sample it works
Hi Jeff,
Yes, if you have my converters installed you need to use the snippets in my documentation for those editors instead of the standard snippets in the Umbraco documentation.
Jeavon
is working on a reply...