Input controls are essential in any application, but they are especially important when WEB applications represent the image of your organization. These controls may be the primary yardstick by which users can judge your application and even your organization's credibility.
In Windows® and Web programming, the user interface is built by creating controls. But the available controls are not particularly rich. The input controls for Windows forms are still based on the win32® control, and Web controls are not much better than the HTML <INPUT> markup wrapper. Obviously, we need better input controls, especially for developers who write ASP.net AJAX applications, because these controls are very dependent on the interaction of client users.
In this two-part series, I'll focus on the input features of ASP.net 3.5, but most of the information I want to illustrate also applies to ASP.net 2.0 with the asp.net AJAX Extensions installed. I'll discuss how to enhance the ASP.net input control functionality by using some of the JavaScript-driven behavior that is provided in the AJAX Control Toolkit, which I call act. This month I'll introduce a set of basic ACT input extensions, and I'll go into more advanced features next month.
Entry
ACT is a shared Source library of Web controls that you can download from Codeplex.com/atlascontroltoolkit. ACT extends an existing ASP.net server control through a predefined block of script code. The ACT extender can be applied to built-in and custom asp.net controls.
Technically, the ACT component adds additional JavaScript layers on top of controls such as TextBox and Panel. Therefore, the use of AJAX is not required. However, the implementation of the ACT component relies heavily on the JavaScript features in the Microsoft®ajax Library and the asp.net AJAX Extensions server runtime.
ACT Authorization specification is located in Asp.net/ajax/ajaxcontroltoolkit. The ACT project page on CodePlex has two columns to download: asp.net 2.0 and asp.net 3.5 with AJAX Extensions (see Codeplex.com/atlascontroltoolkit/release/pro jectreleases.aspx).
To use act in an asp.net application, you need to refer to the assembly in your project, and then register the Act with any page that uses it. The way to register the ACT for each page is to use the @Register directive and specify any prefix, for example:
<%@ Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="act" %>
In addition, you can register the library in the Web.config file for all pages in the application. Here is the configuration script to use:
<pages>
<controls>
<add tagPrefix="act"
namespace="AjaxControlToolkit"
assembly=" AjaxControlToolkit" />
</controls>
</pages>
The ACT control does not automatically appear in the Visual Studio Toolbox, but it is easy to add a new tab, as shown in Figure 1.
Figure 1ACT in Visual Studio 2008