Copied to clipboard

Flag this post as spam?

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


  • Sean Dooley 289 posts 528 karma points
    Jul 15, 2011 @ 11:44
    Sean Dooley
    0

    Add method for DynamicMediaList?

    Using a DynamicNodeList you can add items using the following syntax

    var nodes = new DynamicNodeList();
    var n = new DynamicNode(itemId);
    nodes.Add(n);

    But when I try the following

    var nodes = new DynamicMediaList();
    var n = new DynamicMedia(mediaId);
    nodes.Add(n)

    The below message appears

    umbraco.MacroEngines.DynamicMediaList' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'umbraco.MacroEngines.DynamicMediaList'

    How do you add DynamicMedia to a DynamicMediaList?

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Jul 15, 2011 @ 12:17
    Sebastiaan Janssen
    0

    Currently, DynamicMediaList does not have an add method. If you get a copy of umbraco.MacroEngines.dll from one of the nightlies, you will be able to use this code:

        var nodes = new DynamicMediaList();
        var n = Model.MediaById(mediaId);
        nodes.Add(n);

    Otherwise, just stick them in a generic List<DynamicMedia>.

Please Sign in or register to post replies

Write your reply to:

Draft