You can't use Section in partial views, but you can write an extension to do the same:
public static class ScriptBundleManager
{
private const string Key = "__ScriptBundleManager__";
/// <summary>
/// Call this method from your partials and register your script bundle.
/// </summary>
public static void Register(this HtmlHelper htmlHelper, string scriptBundleName)
{
//using a HashSet to avoid duplicate scripts.
var set = htmlHelper.ViewContext.HttpContext.Items[Key] as HashSet<string>;
if (set == null)
{
set = new HashSet<string>();
htmlHelper.ViewContext.HttpContext.Items[Key] = set;
}
if (!set.Contains(scriptBundleName))
set.Add(scriptBundleName);
}
/// <summary>
/// In the bottom of your HTML document, most likely in the Layout file call this method.
/// </summary>
public static IHtmlString RenderScripts(this HtmlHelper htmlHelper)
{
var set = htmlHelper.ViewContext.HttpContext.Items[Key] as HashSet<string>;
return set != null ? Scripts.RenderFormat("<script type=\"text/javascript\" src=\"{0}\"></script>", set.ToArray()) : MvcHtmlString.Empty;
}
}
Then in _Layout file, after the end of your script bundles:
@Html.RenderScripts()
Then at the top in your partial view:
@{Html.Register("~/bundles/group_of_relevant_js_files_for_partial_view");}
Then all your required functionality will load after jQuery is defined.
However: note that Kendo js files need to be loaded prior to use of their controls/extensions...so they always need to be at the top of your layout file...that's wacky, but that's life...