title: Pass data from child action to parent in razor
body: <p>When inside a razor view, can you pass data to the view from a child action? IE:</p>
  
  <pre><code>@{
     ViewBag.passedData = "";
  }
  
  @Html.Action("ChildView","ChildController") // Inside the child action (controller or view) magic happens
  
  @ViewBag.passedData // it's not empty!
  </code></pre>
  
  <p>Note that inside child view, I can read the parent view data using <code>ControllerContext.ParentActionViewContext.ViewBag.passedData</code> but when I write to it, nothing happens.</p>
  
  <p>Turns out that to access the .passedData property, one should use in the parent View:</p>
  
  <pre><code>  @ViewContext.ViewBag.passedData   // Has the passed data!
    @ViewBag.passedData // null
  </code></pre>
  
  <p>This will get the ball rolling but if there is a more proper or formal way to do this please reply.</p>