Click here to Skip to main content
15,906,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one _Layout.cshtml which contains the below scripts

    <script src="~/Scripts/list.min.js"></script>        
    <script src="~/Scripts/moment.js"></script>
    <script src="~/Scripts/jquery.min.js"></script>

and another one child _PartialView.cshtml

if i include the above scripts in master layout the _PartialView.cshtml page functionality is working fine but remaining pages ajax functionalities are breaking because the bundle already has the jquery 7Version .min.js.

If i include   the below scritps 
    <script src="~/Scripts/list.min.js"></script>        
    <script src="~/Scripts/moment.js"></script>
    <script src="~/Scripts/jquery.min.js"></script>

remaining all pages functinalitis are working except _PartialView.cshtml.
Could you please suggest best solution to resolve this issue.


What I have tried:

I have tried to put scripts in child page but not working 
Posted
Updated 16-Jun-17 3:03am

1 solution

Put all the scripts you need in the master layout. Avoid adding scripts to the partial view, but if you must add one make sure it is only needed on that view and nowhere else.

Remember that while your views\layouts are in different physical files, the browser sees a single file stitched together so if your partial views need jQuery there is no need to include them in the partial view if it is in the main layout.
 
Share this answer
 
Comments
DGKumar 19-Jun-17 0:22am    
If i put jquery.min.js file in partial page that partial page is not working. same thing if i put jquery.min.js file in layout the partial page working but remaing ajax call functionality is not working for remaining pages.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900