Copied to clipboard

Flag this post as spam?

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


  • Anthony Candaele 1197 posts 2049 karma points
    Jun 05, 2013 @ 15:44
    Anthony Candaele
    0

    cannot access node from Razor script on altTemplate

    Hi,

    I'm using an altTemplate for pages that are accessed through this link:

    <a href="/research/researchcategory?category=social%20marketing">social marketing</a>

    where 'researchcategory' is my altTemplate

    The problem I have currently that I can't seem to access any node that is from the Razor script that is implemented on this altTemplate:

    var researchprojects = Model.Children.Where("NodeTypeAlias == \"ResearchProject\" && researchCategory == \"" + researchcategory + "\"");

    Is it not possible to access nodes from a Razor script on an altTemplate, or I am I just doing something wrong?

    Thanks for your help,

    Anthony

  • Anthony Candaele 1197 posts 2049 karma points
    Jun 05, 2013 @ 16:15
    Anthony Candaele
    100

    found the solution, this Razor script works:

    var researchprojects = Model.AncestorOrSelf().Descendants().Where("NodeTypeAlias == \"ResearchProject\"  && researchCategory == \"" + researchcategory + "\"");

  • 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