When building an ASP.NET Web Forms application, you can add the controls from the ASP.NET Ajax Library to the Visual Studio Toolbox. That way, when you want to use an Ajax control, you simply can drag the control from the toolbox onto a Web Forms page.
Follow these steps to add the ASP.NET Ajax Library to the toolbox:
- In Visual Studio, create a new ASP.NET Web Site project or ASP.NET Web Application project.
- Open the Default.aspx page in the Visual Studio designer. (The Toolbox displays different items depending on the type of file that is open in the designer, so you must open a Web Forms page.)
- Right-click the Toolbox and then click Add Tab. Name the new tab ASP.NET Ajax Library (you are free to use any name of your choice).
- Right-click beneath the new ASP.NET Ajax Library tab and then click Choose Items… to open the Choose Toolbox Items dialog box.
- Click the Browse button and browse to the location where you downloaded the ASP.NET Ajax Library.
- In the Web Forms folder, select the AjaxControlToolkit.dll assembly and then click OK.
- Click OK to close the Choose Toolbox Items dialog and box and to update the Toolbox with the new controls. All the server controls that are included in the ASP.NET Ajax Library will appear in the Toolbox under the ASP.NET Ajax Library tab.
Adding a Control to a Web Forms Page from the Toolbox
To use the controls, you can drag them from the Toolbox to a page or you can use the Visual Studio Choose Extender wizard. For example, to use an ASP.NET Ajax Calendar control in a Web Forms page, follow these steps:
- Open a Web Forms page and switch to Design view.
- From the Standard tab of the Toolbox, drag a TextBox control to the page.
- From the ASP.NET Ajax Library tab of the Toolbox, drag a ToolkitScriptManager control onto the page. When you do, the System.Web.Ajax.dll and AjaxControlToolkit.dll assemblies are added to the Web application’s Bin folder automatically.
- Right-click the TextBox control and then click Add Extender. Selecting this option causes the Extender Wizard to appear.
- Select the CalendarExtender from the wizard and then click OK.