title: Adding to script bundle from partial view in .NET MVC 5
body: <p>We are making a .Net MVC websolution that is going to be using widgets rendered as HTML.Partials(). We would like to be able for the partial view to add its dependencys in the main page views scripts tags, both css-files as well as javascript files. </p>
  
  <p>Ive been trying with this code in my partial. But the js-file isnt rendered in the layout section of my page. What is wrong?</p>
  
  <pre><code>@{
  
      var bundle = System.Web.Optimization.BundleTable.Bundles.GetRegisteredBundles()
          .Where(b =&gt; b.Path == "~/bundles/jquery")
          .First();
  
      bundle.Include("~/Scripts/addtojquerybundletest.js");
  }
  </code></pre>