Im having MVC5 application and in the view index.cshtml I need to use some java script code ,currently I put the script code inside the view and its working fine. My questi
You better use Razor @section for this.
@section
In your Layout:
My Title ..... @RenderSection("Scripts", false) @RenderBody
In your View:
Welcome! ... @section Scripts { }
Some would prefer to place @RenderSection("Scripts") just before the
@RenderSection("Scripts")
tag instead.