First, Introduction
So far, we've discussed the client-related techniques involved in developing AJAX controls. Now, let's discuss some of the technologies that are relevant to the server side of the process.
It is to be explained that our example in the "Client" section is essentially simply the use of object-oriented JavaScript technology provided by the ASP.NET Ajax framework to enhance a client-side image component, It's not obvious that Ajax technology is involved (except that ScriptManager downloads and manages client script code in the background Ajax). So, this example is simple, and the enhanced control can be used only with client-related knowledge.
However, in actual development, when the client controls to be enhanced involve AJAX technology, or simply want to enhance server-side components such as UpdatePanel controls, we must do relevant server-side programming, This requires that we have an understanding of the classes associated with the server connected that are involved in AJAX control development. Also, it is essential to develop knowledge about ASP.net 2.0 server controls, especially when developing complex Ajax controls.
In this article, we'll reconstruct an enhanced image button control Mysrvimagebutton, which will be based on the ASP.net 2.0 server control ImageButton.
Second, AJAX control development server-side related technologies
First, let's take a look at the AJAX control development server-side related components and their relationships, as shown in Figure 1 in the inheritance diagram between these classes.
Figure 1: Hierarchy diagram between the primary server-side classes involved in control development
The diagram above shows the inheritance relationships between components, controls, and extenders. As you can see, in order to develop a control (note that component and Extender are not covered in this article), we have two choices: first, create a class that derives from ScriptControl, and then create a class that implements the IScriptControl interface. However, if you want to make your control derive from WebControl, then ScriptControl should be a better choice-because it is derived from the WebControl control itself. However, it is more appropriate to implement IScriptControl if you want to create your control from scratch and do not require any intrinsic features of WebControl to be implemented. In addition, choosing to use an interface when you want to add AJAX features to an existing control (such as the Mysrvimagebutton in this article) IScriptControl also be your choice. However, both of these methods require that the following two methods be overloaded: ①, Getscriptdescriptors;②, getscriptreferences.