title: ASP.NET MVC Html.RenderAction method
body: <p>I try to use the method something like this:</p>
  
  <pre><code>&lt;%Html.RenderAction&lt;NavigatorController&gt;(n =&gt; n.Menu());%&gt;
  </code></pre>
  
  <p>but got an exception "A public action method 'Menu' could not be found on controller 'WebUI.Controllers.ProductsController'. Why compiler try to find it in ProductsController, if I specify NavigatorController for this purposes?
  Code in my NavigatorController  very simple:</p>
  
  <pre><code>namespace WebUI.Controllers
  {
      public class NavigatorController : Controller
      {
          public string Menu()
          {
              return "NavigatorController here";
          }
      }
  }
  </code></pre>
  
  <p>P.S. I use RenderAction from ASP.NET MVC Features library.</p>
  
  <p>I resolved this issue. As @jfar mentioned error was something else, error was in my custom controller factory module, that I wrote using Castle.Windsor library, I tried to implement inversion of control describing in Steven Sanderson book (Pro ASP.NET MVC Framework). So, my method that register all Controller types was:</p>
  
  <pre><code>    _container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));
                  IEnumerable&lt;Type&gt; controllerTypes = from type in Assembly.GetExecutingAssembly().GetTypes()
                                                      where typeof(IController).IsAssignableFrom(type)
                                                      select type;
  
  container.Register(Component.For(controllerTypes).LifeStyle.Is(LifestyleType.Transient));
  </code></pre>
  
  <p>After reading some article I replace it by this:</p>
  
  <pre><code>_container.Register(AllTypes.FromAssembly(Assembly.GetExecutingAssembly())
                  .BasedOn&lt;Controller&gt;()
                  .Configure(c =&gt; c.LifeStyle.Transient.Named(c.Implementation.Name.ToLower())));
  </code></pre>
  
  <p>and all work fine now</p>