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 78 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 5908 posts 22603 karma points MVP 4x 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

  • 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