Copied to clipboard

Flag this post as spam?

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


  • Dan Evans 616 posts 988 karma points
    Jul 01, 2015 @ 09:58
    Dan Evans
    0

    Multiple items on a page

    I have the following code which inserts a button(s) on a page. It works fine for the first set but if another set it added lower down the page there is an error thrown:

    The value of parameter 'id' must be either a string or an integer

    @inherits UmbracoViewPage

    @if (Model.Items.Any()) { foreach (var item in Model.Items) {

            if (item.GetValue("buttonLink") != ""){
            var node = Umbraco.Content(item.GetValue("buttonLink"));
    
            <section class="socials-block container">
                <div class="btn-holder">
                    <a href="@node.Url" class="btn-action"><span>@item.GetValue("buttonText")</span></a>
                </div>
            </section>
            }   
                }   
    

    }

  • 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