As for View (not partial), I place JavaScript like the following.
Each View
@section script{
<script type="text/javascript">
..............
</script>
}
_Layout View
<head>
@RenderSection("script", false)
</head>
But this doesn’t work when I place JavaScript on Partial View, which means JavaScript on Partial View does not be rendered on this way.
That’s correct. Partial views aren’t rendered the same way layouts render the main content. One way to solve this is by putting your markup in one partial and your script in another, then from your view render your markup partial normally, but render you script partial in the section: