Is it possible to access an item's parent/container?

Topics: Customizing Orchard
Dec 1, 2011 at 7:30 PM

Hello, I have assigned global setting to a Blog and would like to check the setting when building each BlogPost. Is there a way I can access a BlogPost's parent Blog contentItem?


Dec 1, 2011 at 9:11 PM

Sure. if post is a reference to any part of the post, post.As<CommonPart>().Container.As<BlogPart>() should do the trick.

Dec 1, 2011 at 9:41 PM

It sure did, thank you. Again.