title: Pass a ViewBag instance to a HiddenFor field in Razor
body: <p>Using ASP.NET MVC and Razor, I'm trying to pass a ViewBag item from the controller to a HiddenFor field (using Razor). I get the following message: Extension methods cannot by dynamically dispatched.</p>
  
  <pre><code>  @Html.HiddenFor(m=&gt;m.PortfolioId, ViewBag.PortfolioId);
  </code></pre>