Since I'm using a Lambda expression, the above should equate to true.
Is this an issue with 4.11 or MVC support? Or am I doing something stupid?
I know I can use x.IsVisible but I'm just messing around with the MVC support and I can imagine giving the user more control as to whether they want to show something in a menu, as we often have sites with different sub-menus
I'm no expert but is it not the case that the show in navigation is numeric (if you are using a checkbox like with navihide), either a 1 or a 0 so if you want to use it as a string it needs to be made one?
Umbraco 4.11 using MVC
Maybe I'm being stupid here, but hopefully someone can help..
I have a partial view for navigation and the <li> elements are built in razor like so:
I'm being told that GetProperty does not take 1 argument, but when I examine the definition for GetProperty it does take a string
Since I'm using a Lambda expression, the above should equate to true.
Is this an issue with 4.11 or MVC support? Or am I doing something stupid?
I know I can use x.IsVisible but I'm just messing around with the MVC support and I can imagine giving the user more control as to whether they want to show something in a menu, as we often have sites with different sub-menus
@foreach (var page in Model.Content.AncestorOrSelf().Children.Where(x => x.GetProperty("showInNavigation").Value == "1"))
{
<li>
<a href="@page.NiceUrl()" title="@page.Name">@page.GetProperty("pageTitle").Value</a>
</li>
}
This stops the error but doesn't show all pages
I'm no expert but is it not the case that the show in navigation is numeric (if you are using a checkbox like with navihide), either a 1 or a 0 so if you want to use it as a string it needs to be made one?
Can i ask why you are using x =>?
S
Well done!
I assumed because I was reading it from XML (umbraco.config) it WAS treated as a string.
.ToString() worked a treat - thanks!
Glad to help somone else after years if being helped...
is working on a reply...