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
2008-12-17 12:54:33
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
2008-12-17 13:03:33
I think you need another reference, see the changes I made to my answer
Garry Shutler
2008-12-17 13:27:10
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
2008-12-17 15:23:09
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
2008-12-17 15:30:44
Thanks Trevor, that did the trick.
RedFilter
2008-12-17 16:22:00
I'd added the need for a reference in your web.config to my answer
Garry Shutler
2008-12-18 15:13:41
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
2008-12-19 13:21:06
A:
I would look at Steve Sanderson's implementation of "Partial Requests" found here
E Rolnicki
2008-12-17 15:42:31