ScriptManager

The ScriptManager control manages client script for AJAX-enabled ASP.NET web pages. By default, the ScriptManager control registers the script for the Microsoft AJAX Library with the page. This enables client script to use the type system extensions and to support features such as partial-page rendering and web-service calls.

The ScriptManager control requires specific settings in a web.config file in order to function correctly. If you try to work with this control, and your site doesn't contain the required web.config file, errors appear in the Design view of the page where the control would have appeared. In Design view, if you click the control that is in that state, Microsoft Expression Web will give you the option to create a new web.config file or update your existing web.config file.

Scenarios

You must use a ScriptManager control on a page to enable the following AJAX features of ASP.NET:

  • Client-script functionality of the Microsoft AJAX Library, and any custom script that you want to send to the browser.

  • Partial-page rendering, which enables regions on the page to be independently refreshed without a postback. The ASP.NET UpdatePanel, UpdateProgress, and Timer controls require a ScriptManager control in order to support partial-page rendering.

  • JavaScript proxy classes for web services, which enable you to use client script to access web services and specially marked methods in ASP.NET pages. It does this by exposing the web services and page methods as strongly typed objects.

  • JavaScript classes to access ASP.NET authentication, profile, and roles application services.

Background

When a page contains one or more UpdatePanel controls, the ScriptManager control manages partial-page rendering in the browser. The control interacts with the page life cycle to update the parts of the page that are inside UpdatePanel controls. For more information, see Partial-page rendering overview.

The EnablePartialRendering property of the ScriptManager control determines whether a page participates in partial-page updates. By default, the EnablePartialRendering property is true. Therefore, by default partial-page rendering is enabled when you add a ScriptManager control to the page. For information about how to use the UpdatePanel control with the ScriptManager control, see Tutorial: How to refresh an UpdatePanel control at a timed interval and Tutorial: How to create a page with two independently updating regions.

The ScriptManagerProxy Class

Only one instance of the ScriptManager control can be added to a page. The page can include the control directly, or indirectly inside a nested component such as a user control, content page for a master page, or nested master page. If a page already contains a ScriptManager control, but a nested or parent component needs additional features of the ScriptManager control, the component can include a ScriptManagerProxy control. For example, the ScriptManagerProxy control enables you to add scripts and services that are specific to nested components. For more information, see ScriptManagerProxy.

For more information about the ScriptManager control, see ScriptManager Control Overview Cc295440.xtlink_newWindow(en-us,Expression.40).png in the MSDN Library.

For a description of all ScriptManager control properties, see ScriptManager Properties Cc295440.xtlink_newWindow(en-us,Expression.40).png in the MSDN library.

See also

Concepts

ASP.NET Ajax controls
UpdatePanel
UpdateProgress
Timer
Partial-page rendering overview

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.