RenderAction in an HtmlHelperExtension Method?

Posted by TimLeung on Stack Overflow See other posts from Stack Overflow or by TimLeung
Published on 2010-04-22T02:06:26Z Indexed on 2010/04/22 2:13 UTC
Read the original article Hit count: 291

I am trying to call the RenderAction Extension Method within my own Html Helper:

System.Web.Mvc.Html.ChildActionExtensions.RenderAction(helper, "account", "login");

this is so that along with some additional logic, I would like all html helpers to use a common method name structure when calling it on the view:

<%= Html.CompanyName().RenderAccount() %>

but the problem I am having is that, asp.net will complain about not finding the actual route it needs to process. It does not take in the parameters of "controller" to be used as the action and "login" to be used as the action. It seems to only reference the current route.

Any ideas how I can package up the RenderAction?

© Stack Overflow or respective owner

Related posts about extension-methods

Related posts about htmlhelper