Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Hefin Jones 39 posts 161 karma points
    Mar 01, 2013 @ 12:45
    Hefin Jones
    0

    6.0.1 - Loop through Multi-Node Tree Picker

    Hello!

    I've just upgraded my Umbraco instance from 6.0.0 to 6.0.1 and notice that some of my Razor scripts are not working anymore.  This piece of code, which worked fine prior to the upgrade, now doesn't work:

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @using umbraco.MacroEngines;
    @using uComponents.DataTypes.UrlPicker.Dto;
    @using umbraco.NodeFactory;
    @{ 
    if (Model.HasValue("homepageFeaturesToDisplay"))
    {        
    <ul id="homePageFeatures">
    @foreach (var features in Model.homepageFeaturesToDisplay) {
    // do stuff here
    }
    }
    }

    It fails with the following error:

     

    Error Loading Razor Script (file: Show Home Page Features) Cannot implicitly convert type 'umbraco.MacroEngines.PropertyResult' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?)    at CallSite.Target(Closure , CallSite , Object )
      at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
      at ASP._Page_macroScripts_ShowHomePageFeatures_cshtml.Execute() in c:\Users\HeJJones\documents\web team\websites\umbraco_websites\st catherines walk\umbraco_stcatherineswalk\macroScripts\ShowHomePageFeatures.cshtml:line 10
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
      at System.Web.WebPages.WebPage.ExecutePageHierarchy()
      at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)

    Has anything changed in the upgrade that would cause this?  One thing I have noticed (i think) is that "Model.homepageFeaturesToDisplay" is returning a String value and not umbraco.MacroEngines.DynamicXml as seemed to be the case in v6.0.0.  I have looked at this documentation, and my code seems to follow the process I should be coding but it's not working since the upgrade.

    Is this a bug in 6.0.1 or is there an new way I should be coding this functionality?  What is the "correct" way of coding it?

    Thanks in advance .... Hefin

  • Hefin Jones 39 posts 161 karma points
    Mar 05, 2013 @ 16:48
    Hefin Jones
    100

    Managed to download and apply v6.0.3 as discussed here http://issues.umbraco.org/issue/U4-1824 which resolved my issues without changing any of my original code.

Please Sign in or register to post replies

Write your reply to:

Draft