MVC Sections DON’t Work in Partial Views

Published on Thursday, January 16, 2014

We add JavaScript or jQuery in ASP.NET MVC views in the scripts section:

@section Scripts   

However, we should know above section does NOT work in partial  view.

What we can do are:

1: Put JavaScript in Parent view, or,

2: Put all JavaScript to a separate .js file; or,

3: Custom helpers. for example.