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 12, 2015 @ 12:23
    Thomas Lee
    0

    AncestorOfSelf

    Hi guys,

    Does anyone know why this isnt working?

    var uniCode = 1337; var result = CurrentPage.AncestorOrSelf(1).Descendants("brandAdvocate").Where(("University==@uniCode");

    But this is:
    var result = CurrentPage.AncestorOrSelf(1).Descendants("brandAdvocate").Where(("University==1337"));

    Thanks in advanced!

  • Martin 114 posts 313 karma points
    Jun 12, 2015 @ 12:52
    Martin
    0

    Try Where("University=@0", uniCode) instead. I also think you have one to many "(" after Where.

  • John Churchley 272 posts 1258 karma points c-trib
    Jun 12, 2015 @ 12:56
    John Churchley
    0

    Appears to be an extra ( after .Where

    .Where("University==@uniCode") not .Where(("University==@uniCode");

  • John Churchley 272 posts 1258 karma points c-trib
    Jun 12, 2015 @ 13:06
    John Churchley
    0

    Have you considered using LINQ?

    var a = 1337;
    var result = Model.Content.AncestorOrSelf(1).Descendants("brandAdvocate").Where(x => x.GetPropertyValue<int>("Unviersity")== a);
    
Please Sign in or register to post replies

Write your reply to:

Draft