Copied to clipboard

Flag this post as spam?

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


  • Eric K 6 posts 36 karma points
    Dec 30, 2014 @ 01:29
    Eric K
    0

    IPublishedContent does not contain a definition for 'IsVisible'

    Greetings.

    Upgraded our site from 6.1.3 to 7.2.1 and having trouble getting things running. The error I can't solve is

    CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'IsVisible' and no extension method 'IsVisible' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)

    I have a partial view like below. I get this error for .AncestorOrSelf(2), .IsVisible and .IsDocumentType.

    @using Umbraco.Core.Models;
    @inherits Umbraco.Web.Mvc.UmbracoViewPage<IPublishedContent>
    @{
        Layout = null;
        var parent = Model.AncestorOrSelf(2);
    }
    
    @foreach (var node in parent.Children.Where(x => x.IsVisible() && !x.IsDocumentType("NewsArticle")))
    {
         //Logic here
    }
    

    Are there some breaking changes I am missing here? My online research is not yielding anything.

    Thanks!

    Eric

  • Eric K 6 posts 36 karma points
    Dec 30, 2014 @ 02:19
    Eric K
    0

    Seems I found the issue. I needed to add the following using statement:

    @using Umbraco.Web;
    

    Although I include this in the web.config file in my Views folder, somehow it wasn't working.

  • 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