Copied to clipboard

Flag this post as spam?

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


  • Jason Espin 368 posts 1335 karma points
    May 16, 2014 @ 15:43
    Jason Espin
    0

    Cannot access standard Umbraco Fields Umbraco 7.1.2

    Hi all,

    I am currently having issues with the following code:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
      var homepage = CurrentPage.AncestorsOrSelf(1).First();
      var travelTips = homepage.travelTips.First();
    
      //Select single travel tip at random and output to page
      var tip = travelTips.Children.Random();
    }
    <div class="travelTips widget">
        <span class="widgetHeader">Travel Tip <span class="orange">#@tip.pageID</span></span>
        <div class="widgetBody">
            @tip.pageContent
        </div>
    </div>
    

    In this situation, the pageContent (which is a user defined property) of the retreived tip content node is being output to the screen correctly however, the standard property of pageID is being returned as blank. Why is this and how can I get around this?

  • Steve Morgan 1348 posts 4457 karma points c-trib
    May 16, 2014 @ 15:53
    Steve Morgan
    100

    Hi,

    Are you after the Umbraco Node ID?

    Try #@tip.Id

     

Please Sign in or register to post replies

Write your reply to:

Draft