Reputation: 495
I am trying to figure this out and not sure the correct solution in MVC5 (I am somewhat new to bundles).
Basic site out from new site wizard visual studio using bootstrap.
mydomain.z\
mydomain.z\Home
mydomain.z\Home\Index
mydomain.z\Home\Contact
mydomain.z\Shared\Layout.cshtml
My layout has the render script from the bundles. It all works fine when I am at the root index page: mydomain.z/
When you start the site it is navigating to mydomain.z/ then if you navigate to the contact view page mydomain.z/Home/Contact this is where I run into problems.
The bundle renders as /Scripts/Scripts.js for example not ../../Scripts/Scripts.js
What is the correct way to fix this pathing issue, do I have to render the scripts in every page, why not know the path from the requesting controller/page?
@Scripts.Render("~/bundles/jquery")
Upvotes: 0
Views: 57
Reputation: 495
Must user the @section to add scripts so it renders after the jquery include
@section scripts
{
<script>
$('#myModal').modal('show')
</script>
}
Nothing was wrong with the paths like Darin Dimitrov noted. I was over-thinking the problem.
Upvotes: 0