开发者

asp mvc RenderSection and multiple injectors?

开发者 https://www.devze.com 2023-02-25 04:38 出处:网络
Simple question, I have a simple _Layout page and I am trying to group all my javascript at the bottom, like below:

Simple question, I have a simple _Layout page and I am trying to group all my javascript at the bottom, like below:

<!DOCTYPE html>
<html>
    <head>
        <title>@ViewBag.Title</title>
        @RenderSection("ViewCssIn开发者_JAVA技巧cludes")
    </head>
    <body>
        @RenderBody()
        @RenderSection("ViewJavascriptIncludes")
    </body>
</html>

Now currently I have 2 partials which include js files relating to their partial (presenter/view js files). So I would be wanting to inject into 1 section from 2 partials, so it would append opposed to overwriting...

Now I am pretty sure you cannot do this, and also I am pretty sure that you cannot call @Section ViewJavacriptIncludes {} from within a partial, but I thought on the off chance that it is possible I would ask in here...

So is it possible to have RenderSections be appended from multiple sources?


Check this answer, it might help.

0

精彩评论

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