Copied to clipboard

Flag this post as spam?

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


  • Sam Ashton 4 posts 25 karma points
    Mar 05, 2014 @ 10:05
    Sam Ashton
    0

    jQuery Carousel Razor Macro

    Good Morning Gentlemen,

    Been scratching my head at this one for a few days, basically I'm trying to develop a macro to display page properties in groups of two. Usually I'd use .InGroupsOf(2) but my macro won't compile and has the error of:

     'umbraco.NodeFactory.Nodes' does not contain a definition for 'InGroupsOf' and no extension method 'InGroupsOf' accepting a first argument of type 'umbraco.NodeFactory.Nodes' could be found (are you missing a using directive or an assembly reference?)

    Code below:

    @using umbraco.NodeFactory
    @using System.Linq
    @{
            var specificNode new Node(2654);
            var 0;
      }
    @if (specificNode.Children.Count 0)
    {
     <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="false" style="clear: both">
      <!-Indicators -->
      <ol class="carousel-indicators">
       @foreach (Node childPage in specificNode.Children.InGroupsOf(2))
       {
        if (== 0)
        {
          <li data-target="#carousel-example-generic" data-slide-to="@i" class="active"></li>
        }
        else
        {
          <li data-target="#carousel-example-generic" data-slide-to="@i"></li>
        }
        i++;  
       }
      </ol>
       <!-Wrapper for slides -->
       <div class="carousel-inner">
       @{0;}
       @foreach (Node childPage in specificNode.Children)
       {
        if (== 0)
        {
          <div class="item active">
          <div style="background: url('media/23917/purplebg.png') top left no-repeat; height: 200px; position: relative;">
          <div style="background-color: #FFFFFF; height: 157px; width: 34%; position: relative;top: 16px;right: -19px; border-radius: 15px;">
         </div>
               <p>@childPage.GetProperty("author").Value.ToString()</p>
         </div>
          <div id="testimonial" class="carousel-caption">
            @Html.Raw(childPage.GetProperty("testimonial").Value.ToString())
          </div>
        </div>
        }
        else
        {
          <div class="item">
          <div style="background: url('media/23917/purplebg.png') top left no-repeat; height: 200px;"><div style="background-color: #FFFFFF; height: 157px; width: 937px; position: relative;top: 16px;right: -19px; border-radius: 15px; width: 34%; height: 74%;">
         </div>
               @Html.Raw(childPage.GetProperty("author").Value.ToString())
         </div>
          <div id="testimonial" class="carousel-caption">
            @Html.Raw(childPage.GetProperty("testimonial").Value.ToString())
          </div>
        </div>
         
        }
        i++;
      }
      </div>
      <!-Controls -->
      <class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left"></span>
      </a>
      <class="right carousel-control" href="#carousel-example-generic" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right"></span>
      </a>
    </div>
    }

    Edit: Unsure why half my code displays as commented out :S

    Thanks,

    Sam 

    :)

Please Sign in or register to post replies

Write your reply to:

Draft