Copied to clipboard

Flag this post as spam?

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


  • Drew DeVault 22 posts 43 karma points
    Nov 16, 2011 @ 02:47
    Drew DeVault
    0

    Error: Cannot invoke a non-delegate type

    I'm not sure what's wrong with this code.  It seems pretty straightforward:

    @{
      var node = @Model.NodeById(@Parameter.adNode).Children.ElementAt(new Random().Next(0,
                  @Model.NodeById(@Parameter.adNode).Children.Count() - 1));
      }
    <div>
      <img src="@Model.GetMedia(@node.image)" />
      <div class="fb-like" data-href="@node.likeLink" data-send="false" data-layout="button_count" data-width="250" data-show-faces="false"></div>
    </div>

    Here's how the template uses it:

          <umbraco:Macro Alias="ShowAd" adNode="1363" runat="server"></umbraco:Macro>

    Any ideas why I could get the "Cannot invoke a non-delegate type" error?

    The goal of this macro is to pick a random ad node and render its contents.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 17, 2011 @ 19:39
    Sebastiaan Janssen
    0

    A late reply, but what exactly are you trying to do here?? I'm sure there's an easier way of doing things then going trough an array of items, that just looks painful.

     

Please Sign in or register to post replies

Write your reply to:

Draft