Copied to clipboard

Flag this post as spam?

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


  • khansaa111 25 posts 55 karma points
    Jun 01, 2015 @ 16:42
    khansaa111
    0

    condition where in umbraco

    Hi everyone

    I can retrieve the value of my fields using @CurrentPage.alias ,

    the problem is that I want to add a condition , but I do not know the syntax , *

    something like @CurrentPage.alia.where..............

  • Chris Wilson 100 posts 377 karma points
    Jun 01, 2015 @ 17:20
    Chris Wilson
    0

    That will return a dynamic object, so you must know the syntax to continue.

    You should be able to get an equal, strongly-typed object from @Model.Content, in which case you can use Intellisense to form the query.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jun 01, 2015 @ 22:29
    Dennis Aaen
    0

    Hi khansaa111,

    Since you are using the dynamic implementation of Razor you can use this syntax below to implement a where condition in your Razor.

    In the code below you will get pages where it does not have site UmbracoNaviHide to true. https://our.umbraco.org/wiki/reference/umbraco-best-practices/umbraconavihide

    @CurrentPage.Alias.Where("Visible");
    

    Then you can use it in a foreach loop for instance to loop page to a navigation or something like that.

    If you have a concrete example of what you are trying to use in your Where clause then I would try to provide you some working example.

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft