How to: Enable a Web Site to Use ASP.NET AJAX Extensions
To incorporate the ASP.NET 2.0 AJAX Extensions into a Web site, developers must configure it by performing a series of steps. When you create a Web site using the ASP.NET AJAX-enabled Web Site template in Visual Studio (this template is installed by the ASP.NET
2.0 AJAX Extensions), the generated Web site is preconfigured to support ASP.NET AJAX and you do not have to perform extra manual steps to enable it. However, if you create a Web site without using the AJAX-enabled template and then you want to incorporate
the ASP.NET AJAX extensions to the Web site, you have to manually configure it. To automate these steps, this bundle includes a recipe named Enable Ajax. This recipe updates the configuration file of your Web site to include ASP.NET AJAX configuration settings
and adds a reference to the ASP.NET AJAX assembly.
This topic describes how to use the Enable Ajax recipe to enable ASP.NET AJAX for an existing Web site.
The Enable Ajax recipe can be executed on a Web client solution and on a regular ASP.NET solution, either on a Web site or a Web Application project.
The Enable Ajax recipe requires the following:
- The Microsoft ASP.NET 2.0 AJAX Extensions 1.0
- An existing Web site
- The Web Client Development Guidance Package enabled
The following procedure describes how to enable the Web Client Development Guidance Package.
You do not need to enable the guidance package on a Web client solution because the guidance package is automatically enabled when you create the solution.
To enable the Web Client Development Guidance Package with the Guidance Package Manager
You use the Guidance Package Manager to enable and disable packages.
- Using Visual Studio, open your solution.
- On the Tools menu, click Guidance Package Manager.
- In the Guidance Package Manager dialog box, click Enable/Disable Packages.
- In the Enable and Disable Packages dialog box, select the check box for the
Web Client Development October 2007 guidance package, as shown in Figure 1.
The following procedure describes how to run the Enable Ajax recipe on a Web site or Web Application project.
To use the Enable Ajax recipe to enable ASP.NET AJAX support in a Web site or Web Application project
The Enable Ajax recipe menu.
- In Solution Explorer, right-click the Web site or Web Application project that you want to enable to use ASP.NET AJAX, point to
Web Client Factory, and then click Enable Ajax, as shown in Figure 2.
You will have the following elements in your Web site or Web Application project:
- A reference to the Microsoft ASP.NET 2.0 AJAX Extensions assembly
- An updated Web.config file that contains the configuration information required by the ASP.NET 2.0 AJAX Extensions. The Enable Ajax recipe performs the steps described in
Configuring ASP.NET AJAX. For a detailed description of the steps performed by the recipe, see the section “Adding ASP.NET AJAX Configuration Elements to an Existing Web Site” in
the aforementioned topic.
The following are typical tasks that you perform after you enable the ASP.NET AJAX Extensions in your Web site:
- Add a ScriptManager control. You need to add a ScriptManager control to the page where you are going to use the ASP.NET AJAX Extensions. You can optionally add the
ScriptManager control to your master pages.
- Add a reference to the ASP.NET AJAX Control Toolkit. The ASP.NET AJAX Control Toolkit complements the core ASP.NET AJAX Extensions by providing a set of client-side controls and server-side extenders that you can use as-is or as the basis for your
own AJAX toolkit.