I am trying to get the parent block (which is a property) in the child page.
I got this
var page = contentRepository.Get(currentPage.ParentLink);
But how to get the property?
Now you get the parent page to the currentpage, nothing to do with blocks.What do you want to do?
Now I am trying to get refrence to my parent pages block. Let say the block name is "ABC". I want to show the same block on child pages
Only one or all blocks in the parent pages contentarea?
Look at this one
Only one block.
Ok, then look in the link I linked earlier, that way you can first get the parent page contentarea (either strongly typed of with .Propery[""] and then loop through the content areas blocks to you find the one you are looking for.I would say that it feels like a hack for somehting the editor can do them self by adding the block in both pages
Yeah I agree, the issue is that there are a lot of child pages and then all the child pages would have to create that block manually.
Then create a new property on the parent page with a contentarea for those blocks that will be inherited and then create a instans of the parent page in the viewmodel and then just render that property on the child pages.
@Html.PropertyFor(x => x.ParentPage.InheritedBlocksContentAreaProperty)
You are a life saver.
Thanks!!, please mark it as an answer if you think it solved your problem