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
var navAdministration = Umbraco.Content(Guid.Parse("16eaeea1-a39b-4482-95f6-b6d27c6584a3")) .Children<ContentPage>() .Where(x => x.IsVisible()) .Where(x => x.ShowOnLeftNavigation == true) .Where(x => x.LeftNavigationSection == "Administration");
How can I have the query return all Content Types and not only the pages that are "contentPage"
hi
Try this
var navAdministration = Umbraco.Content(Guid.Parse("16eaeea1-a39b-4482-95f6-b6d27c6584a3")) .Descendants()
That worked for getting all the pages but now How do I get the section they belong to? Where and/or How would I add
.Where(x => x.ShowOnLeftNavigation == true) .Where(x => x.LeftNavigationSection == "SECTION-NAME");
P.S Every Page/Content Type has the 2 properties (ShowOnLeftNavigation and LeftNavigationSection)
like this
var navAdministration = Umbraco.Content(Guid.Parse("16eaeea1-a39b-4482-95f6-b6d27c6584a3")) .Descendants().Where(x => x.ShowOnLeftNavigation == true) .Where(x => x.LeftNavigationSection == "SECTION-NAME");
This is what happends when I do that
looks like models builder issue
I rebuild the models and restarted the application, but still the same issue
try this one:
var navAdministration = Umbraco.Content(Guid.Parse("16eaeea1-a39b-4482-95f6-b6d27c6584a3")) .Descendants() .Where(x => x.Value<bool>("showOnLeftNavigation") == true) .Where(x => x.Value<string>("leftNavigationSection") == "SECTION-NAME");
You are amazing, that seems to be working, I will do some testing to make sure.
The final query I am using is:
var navAdministration = Umbraco.ContentAtRoot().FirstOrDefault() .Descendants() .Where(x => x.IsVisible()) .Where(x => x.Value<bool>("showOnLeftNavigation") == true) .Where(x => x.Value<string>("leftNavigationSection") == "SECTION-NAME");
Just in case someone else is having a similar issue
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting all the pages
How can I have the query return all Content Types and not only the pages that are "contentPage"
hi
Try this
That worked for getting all the pages but now How do I get the section they belong to? Where and/or How would I add
P.S Every Page/Content Type has the 2 properties (ShowOnLeftNavigation and LeftNavigationSection)
like this
var navAdministration = Umbraco.Content(Guid.Parse("16eaeea1-a39b-4482-95f6-b6d27c6584a3")) .Descendants().Where(x => x.ShowOnLeftNavigation == true) .Where(x => x.LeftNavigationSection == "SECTION-NAME");
This is what happends when I do that
looks like models builder issue
I rebuild the models and restarted the application, but still the same issue
try this one:
You are amazing, that seems to be working, I will do some testing to make sure.
The final query I am using is:
Just in case someone else is having a similar issue
is working on a reply...