Is it possible to add ScriptReference to Master CompositeScript using markup?

I would like to use the ScriptManager and CompositeScript components in my master page to include JavaScript throughout my site, but add this list to my "web content form". I'm sure it can be done in code, but optimally I'd like to do it in markup. Can this be done?

In: MasterPage.master

<asp:ScriptManager ID="ScriptManager" runat="server" EnableScriptCombine="True">
    <CompositeScript>
        <Scripts>
            <asp:ScriptReference name="" Assembly="" Path="/client/js/main.js"/>      
        </Scripts>
    </CompositeScript>
</asp:ScriptManager>

      

In: Content.aspx

<asp:ScriptReference name="" Assembly="" Path="/client/js/other.js"/>

      

+1


source to share


1 answer


Try using a tag <asp:ScriptManagerProxy>

. It got the same child tags as the script manager, but is intended to be used in the content form. (You will not get the "Only one ScriptManager per page" error)

I'm not sure what exactly what you are looking for, because the script added via ScriptManagerProxy is only available in the ContentForm you are adding (I think). It won't be a site. However, if you want your site to be narrow, why not just add it to the MasterPage?



Hope it helps!

+5


source







All Articles