Ajax Script Manager and Master Pages

asp.net-ajaxmaster-pages

I'm building a new website and want to use Ajax controls.

Do I need to put a ScriptManager control on both the MasterPage and on each content page? or Just on the MasterPage?(or just on the content page?)

Best Answer

Content pages or MasterPages can only have one ScriptManager control on them. If you have a ScriptManager control on your MasterPage, you can drop a ScriptManagerProxy control onto your content pages to use any given specific ASP.NET AJAX functionality like this, for example:

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContent" runat="server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
        <Services>
            <asp:ServiceReference Path="~/MyWebServices/YourCoolWebService.asmx" />
        </Services>
    </asp:ScriptManagerProxy>

    <%-- more content stuff goes here --%>
<asp:Content>