Walkthrough: ASP.NET AJAX Extender Controls
ASP.NET AJAX extender controls enhance the client functionality of ASP.NET Web server controls, such as TextBox controls, Button controls, and Panel controls. By using extenders, you can give users a richer Web-based experience. In this walkthrough you will use an extender control to enhance the functionality of an ASP.NET Button Web server control.
You can add ASP.NET AJAX extender controls to Visual Studio and work with them as you do with other controls. You can create your own extender controls or get them from other sources.
One source for extender controls is the ASP.NET AJAX Control Toolkit. The Control Toolkit provides samples and an SDK to make it simple to create and reuse custom controls and extenders. You can download the ASP.NET AJAX Control Toolkit from the ASP.NET AJAX Control Toolkit Web site.
The Control Toolkit is a community-supported library, and is not supported by Microsoft. This topic discusses extender controls that are in the Control Toolkit as examples of how to work with extender controls. However, you should not interpret the information in this topic to mean that the extender controls discussed here are an official part of ASP.NET or that they are supported controls.
For more information about extender controls in Visual Studio 2008, see ASP.NET AJAX Extender Controls Overview. For additional details about the ASP.NET AJAX Toolkit, see the ASP.NET AJAX Control Toolkit Web site.
In order to complete the procedures in this walkthrough, you will need:
Visual Studio 2008 or Microsoft Visual Web Developer Express.
The ASP.NET AJAX Control Toolkit. You can download the Control Toolkit from the ASP.NET AJAX Control Toolkit Web site.
To begin, you will create an ASP.NET Web site that is enabled for AJAX functionality.
To create a file system Web site
Open Visual Studio 2008 or Microsoft Visual Web Developer Express.
On the File menu, click New Web Site.
In the New Web Site dialog box under Visual Studio installed templates, click ASP.NET Web Site.
In the Location box, select the File System check box, and then type the name of the folder where you want to keep the pages of the Web site.
For example, type the folder name C:\WebSite1.
In the Language list, click Visual Basic or Visual C#, and then click OK.
Visual Studio creates the folder and opens a new Web page named Default.aspx in Source view.
The ASP.NET AJAX Control Toolkit includes several extender controls that can be used to enhance the client functionality of Web server controls.
Before you add an extender control to a server control in the following procedure, you must install the ASP.NET AJAX Toolkit. You can download the Control Toolkit from the ASP.NET AJAX Control Toolkit Web site.
To add an AJAX extender control
Switch to Design view.
If the page does not already contain a ScriptManager control, from the AJAX Extensions tab of the Toolbox, drag one onto the page.
A ScriptManager control is required to support AJAX functionality.
From the Standard tab of the Toolbox, drag a Button control onto the page.
If the Button Tasks shortcut menu does not appear, right-click the Button control and then click Show Smart Tag.
On the Button Tasks menu, click Add Extender.
In the Extender Wizard, in the Choose the functionality to add to Button1 list, click ConfirmButtonExtender, and then click OK.
You can also add an extender control by dragging the extender control from the Toolbox directly onto the Button control.
In the Properties window, expand the Extenders tab, and then expand Button1_ConfirmButtonExtender.
Set the ConfirmText property to Continue?
If the functionality of an extender control is no longer needed, you can remove the extender control.
To remove an AJAX extender control
Switch to Design view.
Select the Button control, and then on the Button Tasks menu, click Remove Extender.
In the Extenders attached to Button1 list, select ConfirmButtonExtender.
Click Remove, and then click OK.