Need Help Developing Context Sensitive Widgets

Topics: Customizing Orchard, General
Oct 27, 2011 at 10:43 PM

I have a routable content type, called House, that gets displayed in the Content Zone of the page when someone views it.

In a separate Sidebar Zone, I need to display some information about or related to the house in question.

In a Widget's Driver in a different zone, how do I access or query the content item that is being displayed in the Content Zone?

 

Regards,

Dave

 

Coordinator
Oct 27, 2011 at 10:49 PM

You don't, you do the reverse of that actually:
http://weblogs.asp.net/bleroy/archive/2011/03/26/dispatching-orchard-shapes-to-arbitrary-zones.aspx

Oct 27, 2011 at 11:47 PM

Of course, I forgot about that. Thank you.

I think that will be fine, but I am wondering how we do the reverse if the client wants to be able to manually add and remove the widget from the admin.

I first thought I would access the RouteData and get the slug from the url, but I am not sure how to pull that off from the widget's driver? Is there a trick to this?

Is there a way to communicate or access model data between zones? Maybe I store something in HttpContext.Items?

Your thoughts are appreciated.

Thanks,

Dave

Coordinator
Oct 28, 2011 at 12:50 AM

Context items or an expando on the layout, anything will do.