Type script manager
I found this resource on the Internet, which is partially related to your problem and may be the biggest thing that can be done in this regard.
The solution does not really appear in the HEAD element, but it helps to add scripts only once from partial views and display them in the main view. Therefore, you donβt have to worry about your partial viewing scenarios. They take care of themselves (being more encapsulated)
Simple ScriptManager for ASP.NET MVC
User approach to the viewing engine
But otherwise, I believe that this may be possible if you save the links in the dictionary (similar to how the top channel works), and then create your own viewing engine, which displays the head at the end of the script rendering.
User approach ViewPage class
You can also write your winning classes for views and partial views. Thus, you can change the way the view is displayed, which will again use some kind of dictionary. You can fill out this dictionary using the Html helper extension extension method or create your own ViewUserControl class that will have this functionality.
Of the three, I believe that the latter is the simplest and can write inside the HEAD element. You can also provide functionality in it that combines resources.
source share