Copied to clipboard

Flag this post as spam?

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


  • Jerker Stigsson 63 posts 122 karma points
    Nov 14, 2012 @ 11:24
    Jerker Stigsson
    0

    Upgrade from 4.7.2 to 4.8 problem

    I'm sorry posting the same question twice in this forum, but I clicked the first attemt as solved. But it was a mistake.

    My razor macros seems to fail after upgrade. Does anyone have an idea?

    Here is error messages:

    Error Loading Razor Script (file: [Razor]NavigationMain) 'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Any'    at CallSite.Target(Closure , CallSite , Object )
    at ASP._Page_macroScripts_NavigationMain_cshtml.Execute() in d:\NET_Umbraco\st5_workcopy_net_Backup2012_11_13\Teleca_v5\macroScripts\NavigationMain.cshtml:line 25
    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)


     

    Additional error message shows on the web where macros are supposed to render:

    Error loading Razor Script NavigationMain.cshtml
    'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Any'

     

  • Mark Bennett 199 posts 375 karma points
    Nov 14, 2012 @ 13:16
    Mark Bennett
    0

    Jerker,

    Might be worth posting up the script code - d:\NET_Umbraco\st5_workcopy_net_Backup2012_11_13\Teleca_v5\macroScripts\NavigationMain.cshtml as it is failing on line 25 but without being able to see line 25 it's going to be pretty hard to work out what the issue is.

    Mark.

  • Jerker Stigsson 63 posts 122 karma points
    Nov 14, 2012 @ 13:41
    Jerker Stigsson
    0

    True, but as I understand the error message after upgrading to 4.8 from 4.7.2, it's about the DynamicNodeList. Does it work in the same way as it did in previous versions?

    Here is the code for my razor macro:

    @using umbraco
    @using umbraco.MacroEngines

    @inherits DynamicNodeContext
    @{
        // Root Node
        var root = @Model.AncestorOrSelf();
        var level = String.IsNullOrEmpty(Parameter.Level) ? 1 : int.Parse(Parameter.Level);
        var parent = @Model.AncestorOrSelf(level);

            <ul id="mega-menu-1" class="mega-menu">
                @*Add the class selected if the root node ID matches our current node ID in the for each loop*@
                @{ var homeSelected = @Model.Level == 1 ? " class=\"selected\"" : string.Empty; }
                <!--<[email protected](homeSelected)><a href="@root.Url">@root.Name</a></li>-->
                @foreach (var item in parent.Children.Where("umbracoNaviHide != true && hideInMainNavi != true"))
                {
                     
                     
                     
                          // Add the class selected if the currentpage or parent nodes (up the tree to the root)
                          // ID matches our current node ID in the for each loop
                          var selected = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? " class=\"selected\"" : string.Empty;
                            <li><a href="@item.Url"@Html.Raw(selected)>@item.Name</a>
             
                            @* if the current page has any children, where the property hidePageInNavigation is not True *@
                            @if (item.Children.Where("Visible").Any())
                            {
                                @* Call our helper to display the children *@
                                @childPages(item.Children)
                            }
                            </li>
                     
                }
            </ul>
    }

    @helper childPages(dynamic pages)
        {
        @* Ensure that we have a collection of pages *@
            if (pages.Any())
            {
            @* Get the first page in pages and get the level *@
                var naviLevel = pages.First().Level;
           
            @* Add in level for a CSS hook *@
            <ul>
                @foreach (var page in pages.Where("umbracoNaviHide != true && hideInMainNavi != true"))
                {
                    <li>
                        <a href="@page.Url">@page.Name</a>
                       
                        @* if the current page has any children, where the property hidePageInNavigation is not True *@
                        @if (page.Children.Where("Visible").Any())
                        {
                            @* Call our helper to display the children *@
                            @childPages(page.Children)
                        }
                    </li>
                }
            </ul>
            }
    }
  • Mark Bennett 199 posts 375 karma points
    Nov 14, 2012 @ 14:18
    Mark Bennett
    0

    Jerken,

    So the .Any() seems to have gone - what about trying something like this instead:

    @if(page.Children.Where("Visible").Count > 0)

    Mark..

  • Jerker Stigsson 63 posts 122 karma points
    Nov 14, 2012 @ 16:40
    Jerker Stigsson
    0

    Seems like most of it is gone though. Even Count.

    umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Count

    Seems like the upgrade have changed the DynamicNode

  • Mark Bennett 199 posts 375 karma points
    Nov 14, 2012 @ 17:02
    Mark Bennett
    0

    Jerker,

    Can you run in debug and examine the DynamicNodeList at runtime? Should show you what methods you can call on it.

    Mark.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 14, 2012 @ 17:34
    Jan Skovgaard
    0

    Hi Jerker

    I'm not that deep into razor and different .net versions...I'm just going to add that if you run uComponents you should be aware of this guide by Lee Kelleher on how to ensure it won't break anything after upgrading to 4.8 since the MNTP is now part of the Umbraco core.

    /Jan

  • Jerker Stigsson 63 posts 122 karma points
    Nov 14, 2012 @ 17:53
    Jerker Stigsson
    0

    I upgraded the uComponent to version 5.1. That installation seemed to work out in a good way. Lee Kelleher deals with older versions of uComponent. But does this effect the using of DynamicNode?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 14, 2012 @ 17:54
    Jan Skovgaard
    0

    Turns out Jerker found the solution in this post apparently? :) http://our.umbraco.org/forum/getting-started/installing-umbraco/36147-Upgrade-from-472-to-48-problem

    /Jan

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 14, 2012 @ 17:56
    Jan Skovgaard
    0

    Ups, sorry - read the posts wrong. Turns out it is not solved #h5is.

    No I don't believe that uComponents is the issue here. Just wanted to make sure you knew about the potential issue. If I figure out something I will get back to you.

    /Jan

  • Kenny Burns 173 posts 305 karma points
    Nov 26, 2012 @ 11:55
    Kenny Burns
    0

    Hi Mark,

    I have just had the same issue with Count on v4.11 but I changed it to Count()

    i.e.

    if (node.Level <= maxLevelForSiteMap && node.ChildrenAsList.Count() > 0)

     

    Hope that helps!

    Kenny

  • B.SheshuKumar 10 posts 30 karma points
    Nov 26, 2012 @ 15:20
    B.SheshuKumar
    0

    Hi,

    Please any body can explain me how to create a new website after the sample website is created(After installation of umbraco 4.10)

     

    I get one sample website with starterkit and skin while installing the umbraco 4.10 and when i try to open the new website from template.It is not showing the admin session in the toolbar(which will navigate to the browser).

    Please tell me how to create the new website similar to sample webiste which i got while installing the umbraco 4.9

    Thanks & Regards..

    B.Sheshu kumar

     

Please Sign in or register to post replies

Write your reply to:

Draft