How to render JavaScript into MasterLayout section from partial view?
问题 Given MVC3 and Razor engine, I got _MasterLayout.cshtml @RenderSection("JavaScript", required: false) .. .. @RenderBody() .. View.cshtml with _MasterLayout.cshtml defined in _ViewStart.cshtml .. @Html.RenderAction("PartialView", "PartialController") .. PartialView.cshtml .. @section JavaScript { ........ } .. How can I make sure that JavaScript from Partial View ends up in the Master Layout section? Edit The above scenario doesn't work because the partial view doesn't have a master layout