O'Reilly logo

Learning ASP.NET 2.0 with AJAX by Dan Hurwitz, Jesse Liberty, Brian MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ScriptManager

Microsoft realized that the job of integrating the standard ASP.NET controls and pages with AJAX controls (that encapsulate JavaScript and DHTML) would be difficult, tedious and repetitious. So they did it for you with the ScriptManager control, ensuring that you have access to a fully tested, reliable control that manages the "grunt" work. Adding a ScriptManager control to your page (which the IDE does automatically when you create an AJAX-enabled project) solves the problem, and having one on the page that you don't need comes at virtually no cost. Here is the declaration that must appear in every page, and which is put there for you by the IDE:

	<asp:ScriptManager ID="ScriptManager1" runat="server" />

The ScriptManager control will also be visible in Design view, as shown in Figure 3-1, but will not be visible when the web site is run.

Implementing partial-page updates is surprisingly easy using ASP.NET AJAX—you just leave the ScriptManager's EnablePartialRendering property set to its default value of True.

Having done the hard work of not changing that property, you can then drag one or more UpdatePanel controls onto your page. Each UpdatePanel is updated individually and asynchronously, without affecting one another or anything else on the page.

That's it. Instant and unmistakable performance enhancement with almost no programmer effort.

The ScriptManager control is visible on the page in Design view, but you won't see it in the browser.

Figure 3-1. The ScriptManager ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required