Copied to clipboard

Flag this post as spam?

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


  • Thomas Lee 38 posts 79 karma points
    Jun 09, 2015 @ 13:56
    Thomas Lee
    0

    UmbracoHelper Filter

    Hi guys,

    Does anyone know if i can do this is razor?

    @{

    var result = umbraco.ContentAtXPath(//News).Where( "Select the first News article where section = 'Sports'");

    }

    Section is a custom dropdownlist datatype for the News Document Type.

     

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jun 11, 2015 @ 09:41
    Alex Skrypnyk
    0

    Hi Thomas,

    Try this code:

    var result = Umbraco.TypedContentAtRoot().First().Descendants().Where(x => x.DocumentTypeAlias.Equals("News") && x.GetPropertyValue<string>("section").Equals("Sports"));
    

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft