Using a sample extender

The following steps walk you through the process of using one of the sample ASP.NET AJAX extenders on an ASP.NET web page. As you'll see, it takes less work to hook up the extender than it does to create the page in the first place - and doesn't require writing any code!


Prerequisites
  1. If you haven't already done so, follow the steps to setup your environment
Create a normal ASP.NET page to build on
  1. Using Visual Studio 2005 or Visual Web Developer, create a new web site from the ASP.NET AJAX web site template by opening the "File" menu, clicking "New", "Web Site...", and picking "ASP.NET AJAX Web Site" under "My Templates"
  2. Open Default.aspx by double-clicking it in the Solution Explorer
  3. Switch to design view by clicking the Design tab at the bottom of the window
  4. Add a Label (Label1) by dragging one over from the Toolbox
  5. Add a Button (Button1) by dragging one over from the Toolbox
  6. Create a Click handler for the Button by double-clicking it
  7. Default.aspx.cs will open automatically and the cursor will be in the Button1_Click method
  8. Add the code Label1.Text = "Button click was processed.";
  9. Run the page by pressing F5 (enable debugging if prompted) and verify that clicking the Button in the browser changes the Label text
  10. Close the browser window
Add the AJAX Toolkit extender
  1. Add a ConfirmButtonExtender by dragging one over from the Toolbox
  2. Hook up the extender by clicking it, going to the Properties panel, expanding the TargetControlID property drop-down, and choosing "Button1"
  3. Configure the extender by clicking the Button, expanding the ConfirmButtonExtender property, and typing "Are you sure?" for the ConfirmText
  4. Run the page by pressing F5 and notice that clicking the button now brings up a confirmation dialog that can be used to cancel the processing of the button press

That's all there is to it! You're now using an AJAX Control Toolkit extender!


Please refer to the individual sample pages (see the links on the left) for examples of how to use the other samples.

Copyright © 2006 Microsoft Corporation. All Rights Reserved.