Is there any way to load Script or CSS that is placed in Buddles in ASP.NET only in a single View?

Asked

Viewed 38 times

0

Usually when I download the plug-in in Visual Studio in Nuget, it is necessary to put script and css in Buddles however these scripts are loading in all my Views even those that are not using, so I wonder if there is any way to put these Scripts directly in the View, because without putting in Buddles in Visual studio, the plug-ins do not work.

1 answer

0

Yes, there is.

References placed in Bundleconfig do not necessarily have to click on all pages. You can determine which page you want to put the script to as follows:

_Layout.cshtml

_Layout.cshtml

Edit.cshtml

Edit.cshtml

In the above example, four references were included in Bundleconfig (jquery, bootstrap, jqueryval and jsTree). In _Layout.cshtml I am using only jquery and bootstrap references, and in the Edit page I am using jqueryval and jstree references.

That way, the scripts referenced in the Edit page will only load when entering it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.