views:

39

answers:

1

I am developing a site similar to a portal with loads of individual portlets. There is an Overview page and the view calls Html.RenderPartial for about 10 other shared views. All those views are strongly typed and expect some data. So, I have portlets for chat, messages, status and so on.

All this data depends only on the currently logged in user. So, partial view one would need IChatRepository, partial view two IMessageRepository and so on.

Question: How do I pass this to the views? I could pass all this data to the Overview view but it doesn't really need it.

How would I go about this? Does model binding help here? I also have Castle Windsor in place.

+1  A: 

Sounds like RenderAction may be a bit more appropriate for this scenario. If you're using MVC1 you'll need to grab the Futures Assembly to use it and if you're using MVC2 it's built in.

Basically you set up a controller and action to work with some data and output a partial view. You can then call RenderAction in your Overview page for that specific functionality and point it to your new controller and action. You can set your IoC container up to supply the appropriate type to that controller and action as well.

That way you're not passing a bloated view model to your Overview page and you're only working with the repositories you need.

RenderAction, get to know it and you'll love it.

DM
Thanks, sounds exactly like what I need. How did I manage to miss this? :)
Sparhawk