Accessing model data from another zone

Topics: Customizing Orchard
Mar 18, 2012 at 5:46 PM

Taking the Theme Machine template as an example... if I have custom templates for the BeforeContent zone and the Content zone, and I want to access one bit of Model data in the Content zone from the BeforeContent zone - how can I do this?

My Content zone contains a Page with an extra custom field called BannerPath in it.   I also need to be able to access that field from the BeforeContent zone.

Possible?

Thanks in advance.

Developer
Mar 18, 2012 at 6:52 PM

You can access any zone from any view, as all zones are ultimately part of the Layout shape, accessible via the WorkContext property of any view. Check out this post for more info: http://weblogs.asp.net/bleroy/archive/2011/06/30/so-what-are-zones-really.aspx

Mar 18, 2012 at 10:29 PM

Perfect - thanks!