开发者

ASP.NET MVC2 Inject Javascript to masterpage from partial control

开发者 https://www.devze.com 2023-01-19 12:02 出处:网络
I\'m moving my script references from < head> in the master to bottom right before < /body>. This has caused some problems with my load order.

I'm moving my script references from < head> in the master to bottom right before < /body>.

This has caused some problems with my load order.

In my master I have a ContentPlaceHolder, and I can use this fine from my Views to add additional javascripts.

But how can I add javascripts to this section from a PartialControl?

If I just include the scripts from the control the scripts will load in the wrong order (The script from the PartialControl will render before the scripts in the master). I need to be able to add scripts from my partial view to my ContentHolder in the page.

How shall I tackle this problem? At first I was thinking of an HtmlHelperExtension, but I can't reach the master page from the HtmlHelper object.

开发者_Python百科

Thanks in advance.

0

精彩评论

暂无评论...
验证码 换一张
取 消