tags:

views:

680

answers:

2

I know that within a view I can render an action from the same controller using Html.RenderPartial. However, I need to render the output from an action under a different controller. What is the best way to do this? I would prefer to do this directly within the view, rather than doing it in the controller and saving the output to a ViewData variable.

+1  A: 

The best thing to do is use Html.RenderAction which needs a references to the 'Futures' assembly Microsoft.Web.Mvc which there's a question about how to get it.

You will also need to add the namespace in your web.config in order to user it in your view:

<add namespace="Microsoft.Web.Mvc"/>
Garry Shutler
Ok, I will give that a try shortly when I get to work. For some reason that method does not show in the typeaahead, though. When I Type "Html.", the only render method that shows in the list is RenderPartial. Do you get the same behavior? This is using the Express edition of Visual Web Dev.
RedFilter
I think you need another reference, see the changes I made to my answer
Garry Shutler
I have downloaded the Futures assembly and added a reference to it, and still the Html.RenderAction method is not found or usable. I am using the latest MVC release (10/13/2008) and Futures (10/16/2008).
RedFilter
you need to add the namespace in your web.config in order to user it in your view: <add namespace="Microsoft.Web.Mvc"/>
Trevor de Koekkoek
Thanks Trevor, that did the trick.
RedFilter
I'd added the need for a reference in your web.config to my answer
Garry Shutler
Note that I also needed to do a rebuild before the namespace was found, simply adding the reference and namespace in web.config was not enough.
RedFilter
A: 

I would look at Steve Sanderson's implementation of "Partial Requests" found here

E Rolnicki
Thanks for the link, that is interesting.
RedFilter