I am working on a umbraco project which has some sections that have have subsections and then content below it, like such:
Home
- Event Section
--- Event Category 1
---## Event Item
---## Event Item
--- Event Category 2
---## Event Item
---## Event Item
With this I have 3 templates:
A Main Events Section - showing all events and filtering for category
A Category Event Section - showing events relating to a category
The Event Content - showing all details for a individual event
What I am having trouble with is writing a query that gives me all the individual events to display on the Main Events Section Page and another that gives me all of the events for the Category Event Section which I can display on that page.
Currently I have only achieved to pull all events related to a defined category and I want to know how I can get results without having to define a category.
@{ var eventcat = Model.Content.Site().FirstChild("eventMain").FirstChild("eventList").Children()
.Where(x => x.IsVisible());
}
@foreach(var item in eventcat){ @item.name }
*event main is the main section and event list is the categories
Can anyone point me in the right direction to achieve this?
Thank you for your reply, The solution you have gave me only seemed to return the content for one category, How would I be able to find content for all category's under my section?
Showing the grandchildren
Hi all,
I am working on a umbraco project which has some sections that have have subsections and then content below it, like such:
Home
- Event Section
--- Event Category 1
---## Event Item
---## Event Item
--- Event Category 2
---## Event Item
---## Event Item
With this I have 3 templates:
A Main Events Section - showing all events and filtering for category
A Category Event Section - showing events relating to a category
The Event Content - showing all details for a individual event
What I am having trouble with is writing a query that gives me all the individual events to display on the Main Events Section Page and another that gives me all of the events for the Category Event Section which I can display on that page.
Currently I have only achieved to pull all events related to a defined category and I want to know how I can get results without having to define a category.
*event main is the main section and event list is the categories
Can anyone point me in the right direction to achieve this?
Hi David,
Welcome to our :)
Can you please try to do it like this and see if this works for you.
Hope this helps,
/Dennis
HI Dennis,
Thank you for your reply, The solution you have gave me only seemed to return the content for one category, How would I be able to find content for all category's under my section?
Would this work?
@{
Worked like a treat! Thank you so much!
No problem!
These are pretty handy to get "ideas" of how to traverse nodes (Razor cheat sheets) but by all means keep asking questions until it all clicks!
is working on a reply...