I have a razor
layout and it loads css jquery etc.
When I add controller action view I set layout to be _Layout.cshtml
But jquery doesn't work in that page.
So I have to add @Scripts.Render("~/bundles/jquery")
in each view.
Why imported jquery is not inherited from _Layout.cshtml
? Is it normal?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- MVC-Routing,Why i can not ignore defaults,The matc
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
This should be near the bottom of _Layout.cshtml:
This should be in your child view:
All your scripts (that reference jquery) in your child views need to be in the scripts section, not placed in the body of the page. That includes any script tags that want to make use of jquery as well. For example, one of my pages has the following: