I've been trying to figure out the difference between RenderAction and Action. I don't know if I'm so concerned about the differences at this point, as to why I can't get RenderAction to work. From what I can tell, I'm passing in the correct parameters. The overload I'm using seems to be the same for both:
@Html.RenderAction(Action, Controller, Route)
@Html.Action("Breadcrumb", "Navigation", new {SeoUrl = Model.CarlineBucket.SEOURLName})
@Html.RenderAction("Breadcrumb", "Navigation", new {SeoUrl = Model.CarlineBucket.SEOURLName})
I get a compilation error when I try and use RenderAction:
CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments.
Any tips or hints? Should I not even be bothering with RenderAction?
Try:
@Html.RenderAction()
generates a write call to output something on the page and in your case you are not doing so becauseRenderAction
renders the result directly to the Response.Instead of
Use
From Phil Haack:
The return type of
Html.RenderAction
isvoid
that means it directly render the responses in View where return type of Html.Action isMvcHtmlString
you can catch its render view in the controller and modified it also by using following methodThis will return the Html string of the View.