jquery - Scripts in _layout (MVC) -
all scripts worked fine when had view. , when tried split layout , partial view - scripts no longer worked. please answer questions:
1) links should placed? in view or in _layout? if in layout, should use
@scripts.render() or just
<script src="~/scripts/jquery-1.7.1.js"></script> 2) scripts should placed? in view or in _layout? in head or inside body?
or can this: place scripts in view in
@section scripts{ } and in layout use
@rendersection("scripts", false) ??
sorry silly questions :)
you can following in _layout.cshtml
@scripts.render("~/bundles/bundlename")
where bundlename name of bundle when call registerbundles. alternatively, can following:
@rendersection("scripts", required: false)
also, performance place js bundles @ bottom of page.
Comments
Post a Comment