.net What is the Difference Between Script Manager and Script Manager Proxy ?

  • 490
  • 0

 What is the Difference Between Script Manager and Script Manager Proxy ?

 

Re: What is the Difference Between Script Manager and Script Manager Proxy ?

Oct 09, 2012 02:28 AM|LINK

ScriptManager
A server control that makes script resources available to the browser, including the Microsoft AJAX Library and the functionality that enables partial-page rendering.



ScriptManagerProxy
A server control that enables nested components to add script and service references if the page already contains a ScriptManager control.

The ScriptManager must appear before any ContentPlaceHolders. Generally as Joshua pointed out, the script manager is put at the first element after the form tag. Like so:

<form id="form1" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Path="~/Scripts/jquery.js" />
            <asp:ScriptReference Path="~/Scripts/jqueryui.js" />
            <asp:ScriptReference Path="~/Scripts/menubar.js" />
        </Scripts>
    </asp:ScriptManager>

    <div id="container">

        <asp:ContentPlaceHolder ID="MainContent" runat="server">


        </asp:ContentPlaceHolder>
    </div>
</form>

The reason for this is because the .aspx pages that uses this master page provide content that is placed into the ContentPlaceHolder controls. Because your ContentPlaceHolder appeared before your ScriptManager, the ScriptManagerProxy located in your content page was throwing because the ScriptManager would not be defined until later down the page.

This can be a bit odd to think about because you are defining controls in multiple different places. But the codebehind does not execute until everything is put together.

ScriptManager

ScriptManager control is required to use any ASP.NET AJAX feature or control on the page. It manages client script libraries and JavaScript proxy classes to call web services and provides basic AJAX features such as partial page rendering and asynchronous post backs.

UpdatePanel

UpdatePanel control is the most important and widely used ASP.NET AJAX server control. It enables you to refresh selected parts of the page partially instead of refreshing the whole page with a post back. This control works with ScriptManager control and it provides you facility to perform partial page updates automatically with the help of client script.

資料來源:

https://stackoverflow.com/questions/17974659/how-to-get-scriptmanager-to-work-with-scriptmanagerproxy

https://forums.asp.net/t/1849713.aspx?What+is+the+Difference+Between+Script+Manager+and+Script+Manager+Proxy+

http://www.ezzylearning.com/tutorial/understanding-asp-net-ajax-updatepanel