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 273 posts 490 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 4899 posts 14655 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>.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies