Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
So i'm getting an error "umbraco.MacroEngines.DynamicNodeList does not contain a definition for "NodeTypeAlias""
What is the correct way to check if a node is of a certain document type?
if (page.Children.Where("Visible").Count() > 0 || page.Children.NodeTypeAlias != "LocationPageMC") { <li class="@page.IsLast("last")"> @RenderPageAnchorWithDrop(page) </li> } else { <li class="@page.IsLast("last")"> @RenderPageAnchor(page) </li> }
Hi Amir,
You can do this
if(page.Children.Where("NodeTypeAlias == \"LocationPageMc\"").Count()>0){}
Hi Fuji, thanks for your reply, this returns nothing it seems? It hides the LocationPageMc pages, but also every other page...What I'm trying to achieve is "if page.Children is visible and is NOT LocationPageMC > RenderPageAnchorWithDrop()"
Hi Amir
You should be able to add two Where statements, have used this in the past, but it may depend on the Umbraco Version.
page.Children.Where("Visible").Where("NodeTypeAlias!= \"LocationPageMC\"")
If not post back with Umbraco version you are using and if MVC or webforms, and info on how you create var page, then it may be easier to assist you.
Regards G
Not sure then it should be
NodeTypeAlias !=\"LocationPageMc\""
Gary, Fuji, thanks! The below worked great.
.Where("NodeTypeAlias!= \"LocationPageMC\"")
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Error when checking for NodeTypeAlias in If statement
So i'm getting an error "umbraco.MacroEngines.DynamicNodeList does not contain a definition for "NodeTypeAlias""
What is the correct way to check if a node is of a certain document type?
Hi Amir,
You can do this
Hi Fuji, thanks for your reply, this returns nothing it seems? It hides the LocationPageMc pages, but also every other page...What I'm trying to achieve is "if page.Children is visible and is NOT LocationPageMC > RenderPageAnchorWithDrop()"
Hi Amir
You should be able to add two Where statements, have used this in the past, but it may depend on the Umbraco Version.
If not post back with Umbraco version you are using and if MVC or webforms, and info on how you create var page, then it may be easier to assist you.
Regards G
Not sure then it should be
Gary, Fuji, thanks! The below worked great.
is working on a reply...