title: Calling RenderAction in Controller ASP.NET MVC 4 For Dashboard (Multi) View
body: <p>I have a template HTML string, which at various unknown points has {{Url}} placeholders in it, which relate to certain controller/actions in my application.  What I need to do is render the html into these placeholders, before rendering the final html in a view. </p>
  
  <p>In a view I can simply call <code>Html.RenderAction("Action","Controller")</code> which returns the string I need.  <strong>However</strong>, I need to call this method in the <strong>controller code</strong>, for example (This is simplified):</p>
  
  <p>In "Dashboard" Controller:</p>
  
  <pre><code>var templateHtml = GetTemplateHtml();
  
  //The following line doesn't compile
  var html = Html.RenderAction("Index","PowerAnalysisDashpart");
  
  ViewBag.Html = templateHtml.Replace("{{PowerAnalysisDashpart}}",html)
  </code></pre>
  
  <p>Then in the "Dashboard View":</p>
  
  <pre><code>&lt;div id="content"&gt;
      @Html.Raw(ViewBag.Html)
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I call "RenderAction" to get the Rendered HTML string in the controller?</p>
  
  <p><strong>EDIT:</strong>
  There seems to be confusion over what I am trying to achieve.  Basically, we need administrators to be able to create an HTML template, which will effectively have frames for various different pages of our application.  Iframes would work, but we'd much prefer to have all the HTML built on the server.</p>