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

Topics: Customizing Orchard
Dec 1, 2011 at 8: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?

Thanks

Coordinator
Dec 1, 2011 at 10: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 10:41 PM

It sure did, thank you. Again.