November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
If you just like pages you should got with GetChildren<PageData> or for blocks just BlockData. Or you can use your own pagetype or blocktype as well. You do not need .Any() either. Not sure why it returns blocks as well in your case. Need more information but my guess is that the IContent is causing this.
Do you have any blocks on the page? Block also is structured the same way if you look in adminmode and access rights you will be able to see all content and not anly pages is structured the same way.
Ah sorry Any() is needed for you i guess since you are working with hasChildren :)
Any IContent, blocks, pages, media. If you need just pages, you can use OfType<PageData>() after GetChildren.
BR,
Marija
This page has some blocks on Content Area.
The blocks on Content aren't showing as a Children. I can't find where was add this blocks as children of this page.
On the tree is just on page as children and the same is showing on Access Rights.
Looking to the DataBase these blocks are children of this page. The getChildren are working perfectly.
What would I like to understand is how is possible to add a block as children of a page?
Ah,OK, I wasn't sure what you were aiming for. They are probably not children of the page, but rather either somewhere in the Blocks folder structure (a folder is their parent) or they are placed in the folder "For this page". Again, the folder is the parent, so you won't get them with get children from the page itself.
You should get them by fetching FilteredItems from the content area instead.
BR,
Marija
To add blocks as children of the page, you'd need to do it programmatically, by setting the page as their parent.
Might be better to write the usecase - what you want to achieve from user/editor perspective.
In this case, I have this blocks just in production. It means that was added by the content team and not from code behind.
I'm not sure.
But, when I use GetChildren is it return blocks and pages or just pages?
in this particular code:
I'm getting 3 elements, 1 page, and 2 blocks.
I checked the parentLink is correct. But I have no idea how this was related to this page.