Copied to clipboard

Flag this post as spam?

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


  • Biagio Paruolo 1619 posts 1912 karma points c-trib
    Apr 27, 2012 @ 01:03
    Biagio Paruolo
    0

    Error: 'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'GetChildrenAsList

    I've this runtime error:

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

    I checked DLLs, but I don't find any.

    The code is:

    @{
          
            var items = Model.Parent.Children.Where("customerNo == \"" + @profile.Customer_NavisionCode + "\"");
          }
        <select id="Sede">
    
            
                 @foreach ( var p in items.Children())
            {
                <option>@p.Name</option>
            }
            
            
        </select>

  • gilad 185 posts 425 karma points
    Apr 27, 2012 @ 02:55
    gilad
    0

    items is a DynamicNodeList.

    you dont need the .Children again.

    try this : @foreach(var p in items )


  • Biagio Paruolo 1619 posts 1912 karma points c-trib
    Apr 27, 2012 @ 08:37
    Biagio Paruolo
    0

    My target is to have the first level children of items

  • Michael Latouche 504 posts 819 karma points MVP 4x c-trib
    Apr 27, 2012 @ 09:59
    Michael Latouche
    0

    Hi,

    I think what you should then do is loop through the items, and then display their children, so something like this:

    @{
         
           
    var items =Model.Parent.Children.Where("customerNo == \""+@profile.Customer_NavisionCode+"\"");
         
    }
       
    <selectid="Sede">
     
           
                 
    @foreach(var p in items)
           
    {
    @foreach(var c in p.Children)
    {
                <option>@c.Name</option>
    }
            }
           
           
       
    </select>

    Hope this helps.

    Cheers,

    Michael.

  • Biagio Paruolo 1619 posts 1912 karma points c-trib
    Apr 27, 2012 @ 14:19
    Biagio Paruolo
    0

    I'll try. Children is a member of ' items'? Vs intellisense don't give me it

  • Biagio Paruolo 1619 posts 1912 karma points c-trib
    Apr 27, 2012 @ 23:50
    Biagio Paruolo
    0

    Don't work

    Error

    Unexpected "foreach" keyword after "@" character. Once inside code, you do not need to prefix constructs like "foreach" with "@". 

  • Michael Latouche 504 posts 819 karma points MVP 4x c-trib
    Apr 28, 2012 @ 09:20
    Michael Latouche
    0

    Yes sorry,

    The second "foreach" should not be prefixed with "@". So this should work better:

    @{

    var items =Model.Parent.Children.Where("customerNo == \""+@profile.Customer_NavisionCode+"\"");
    }
    <selectid="Sede">


    @foreach(var p in items)
    {
     
    foreach(var c in p.Children)
    {
    <option>@c.Name</option>
    }
    }


    </select>

    Cheers,

    Michael.

Please Sign in or register to post replies

Write your reply to:

Draft