Copied to clipboard

Flag this post as spam?

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


  • hetaurhet 245 posts 267 karma points
    Feb 12, 2012 @ 06:19
    hetaurhet
    0

    accessing same level nodes

    hello...

    I have parent node say 'story' and its chils nodes as 'story1', 'story2' and so on....

    Now I have created following razor and have added this in 'Story' template which is applied to 'Story' Parent node. Also this template contains class such that 'Prev' & 'Next' arrows are shows and thus on clicking arrow, it shows prev and next child nodes content and heading.

    <!-- start story -->
    @foreach(var item in Model.Children)    
    {
          <div class="slide">
           <h2 align="center">@item.PageHeading</h2>
           @item.content
           </div>
    }
    <!-- end story -->

    this works fine when I run the parent page. But I want this same prev & next to work on each child node also. So how can I procced?

     

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Feb 12, 2012 @ 20:42
    Sebastiaan Janssen
    0

    How about: 

    @foreach(var item in Model.Children)    
    {
          <div class="slide">
           <h2 align="center">@item.PageHeading</h2>
           @item.content
    <a href="Model.Previous().Url">Previous</a> - <a href="Model.Next().Url">Next</a>
           </div
    }

    Also refer to this blog post for more info: http://umbraco.com/follow-us/blog-archive/2011/3/13/umbraco-razor-feature-walkthrough-part-5

  • hetaurhet 245 posts 267 karma points
    Feb 13, 2012 @ 06:42
    hetaurhet
    0

    will chk out

  • 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