Copied to clipboard

Flag this post as spam?

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


  • Roger 14 posts 34 karma points
    1 week ago
    Roger
    0

    Umbraco.Web.MVc.UmbracoTemplatePage not in 8@announcement.GetPropertyValue("title")

    In umbraco 7 to get a list of announcements I would use @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    @{ var announcements = Umbraco.TypedContentSingleAtXPath("//announcementList"); }

    @foreach (var announcement in announcements.Children.Where(x => x.IsVisible() && Umbraco.MemberHasAccess(x.Path)).OrderByDescending(x => x.CreateDate)) {

    @announcement.GetPropertyValue("title")

    @announcement.GetPropertyValue("content")
    }

    in umbraco 8 I do not have Umbraco.Web.MVc.UmbracoTemplatePage. what do I use

  • Shaishav Karnani from digitallymedia.com 277 posts 1264 karma points
    1 week ago
    Shaishav Karnani from digitallymedia.com
    0

    Hi Roger,

    In v8, their is no @announcement.GetPropertyValue("title") Instead you can use @announcement.Value("title")

    This is good article on how to access v8 iPublishedContent. https://our.umbraco.com/documentation/reference/querying/ipublishedcontent/Properties/

    Cheers,

    Shaishav

Please Sign in or register to post replies

Write your reply to:

Draft